I have the problem, i would generaete checkbox in pdf with php, but if i recheck checkbox state i not found checkboxs.
I tried:
- TCPDF (Generate)
- C# (Read, it not found checkbox)
- Python (Read,Pypdf2, it not found checkbox)
Images:
- Acrobat Reader open pdf display checkboxs (https://prnt.sc/uqjny8)
- Python 3.8 reader output (https://prnt.sc/uqjp9o)
- C# code output (https://prnt.sc/uqjpnw)
Files:
- simple PDF without checkbox (http://www.africau.edu/images/default/sample.pdf)
- PDF with checkbox (https://easyupload.io/zjn85z)
PHP checkbox generate code:
$pdf = new \setasign\Fpdi\TcpdfFpdi('L', 'mm', 'A4');
$pages = $pdf->setSourceFile('file://C:/Users/JonDoe/Desktop/sample.pdf');
for ($i = 1; $i <= $pages; $i++)
{
$pdf->AddPage();
$page = $pdf->importPage($i);
$pdf->useTemplate($page, 0, 0);
$pdf->CheckBox('newsletter', 5, true, array(), array(), 'OK1', 600/5, 500/5, true);
}
$pdf->Output("file://C:/Users/JonDoe/Desktop/sample.pdf", 'F');
Reader script:
C#:
using System;
using iTextSharp.text.pdf;;
using System.Linq;
namespace PDF_Checkbox
{
class Program
{
static void Main(string[] args)
{
string path = "C:\\Users\\JonDoe\\Desktop\\sample";
PdfReader reader2 = new PdfReader(@"" + path + ".pdf");
var fieldList = GetFormFieldNamesWithValues(reader2);
Console.WriteLine("============================================================");
Console.WriteLine("Fields: " + fieldList);
Console.WriteLine("============================================================");
Console.ReadKey();
}
}
}
Python 3.8:
import PyPDF2 as pypdf
pdfobject=open('sample.pdf','rb')
pdf=pypdf.PdfFileReader(pdfobject)
print(pdf.getFields())
As you read, I want to see the generated checkboxes state, whether python or c #, php Does anyone know a solution for this?
Aucun commentaire:
Enregistrer un commentaire