Skip Menu |

This queue is for tickets about the CAM-PDF CPAN distribution.

Report information
The Basics
Id: 125299
Status: open
Priority: 0/
Queue: CAM-PDF

People
Owner: Nobody in particular
Requestors: kollmann [...] lab-quade.de
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: CAM::PDF $pdf->fillFormFields(%data ); Field content not visible / printed
Date: Fri, 11 May 2018 11:01:03 +0200
To: bug-CAM-PDF [...] rt.cpan.org
From: "Dr. Harald Kollmann" <kollmann [...] lab-quade.de>
Dear CDOLAN, maybe I am doing something wrong but the inserted content is neither printed nor shown (except when choosing show form). Looking in the pdf -file i can find the content inserted as "form content" and as Text-stream. My colleagues and i were given an official form which has to be filled in and signed (later). We have to use the predefined fonts / sizes. So I was quite happy when i found CAM::PDF and some articles suggesting $pdf->fillFormFields(%data ) is doing exactly what we need. I try to develop the fill-in-tool on a Linux kollmann-nb 4.13.0-41-generic #46~16.04.1-Ubuntu SMP Thu May 3 10:06:43 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux Please look attachments for detailed Perl-Version, perl-code source-pdf (Muster-10...) and generated pdf (test.pdf) ( Sorry but i'n not used to write in English) I am looking forward to hear from you. Yours cincerely Harald -- Mit freundlichen Grüßen Dr. phil. nat. chem. Harald Kollmann Tel. 0221 – 940 564 19 Fax: 0221 – 940 564 330 Medizinisches Versorgungszentrum (MVZ) Labor Dr. Quade & Kollegen GmbH Aachener Str. 338, 50933 Köln Geschäftsführer : Dr. med. Annegret Quade Sitz Köln, HRB 76015, St.Nr.223/5813/6928 Akkreditiert durch die Deutsche Akkreditierungsstelle GmbH (DAkkS) und College of American Pathologists (CAP) Registrierungsnummer D-ML-17419-01-00 (DAkkS) Registrierungsnummer D-PL-17419-01-00 (DAkkS) LAP Nummer 8997219 (CAP)

Message body is not shown because sender requested not to inline it.

Download Muster_10_D(7_2017).pdf
application/pdf 103.2k

Message body not shown because it is not plain text.

Download test.pdf
application/pdf 116.1k

Message body not shown because it is not plain text.

Message body is not shown because sender requested not to inline it.

Hi, I have looked into the issue, CAM::PDF::fillFormFields doesn't encode (compress) appearance stream. Even if there already was "Filter" entry in dictionary of (empty, as in this case) stream in original PDF. Thus, "Field content not visible" because stream can't be decoded. Strange that neither Acrobat nor other viewers complain. Easiest fix is to always compress either newly created or already existing, but to be updated, appearance. 2nd, attempts to fill e.g. checkboxes just won't work, because there's no code to do it -- only text fields are processed. It should be documented and/or warning issued. As to phone number being cropped, -- if suggested patch is applied -- see comment in 4538 line of 1.60 (current) version. Point is, obvious bug was easy to fix, anything else (e.g. "predefined fonts" - ??) is a bit more work and maybe beyond scope. #!/usr/bin/perl use strict; use warnings; use CAM::PDF; my $pdf = new CAM::PDF( 'Muster_10.pdf' ); my %data = ( '8118_Telefonnummer' => "0221 940 564 19", '4205_Auftrag' => "Hubba Hopp!\n Trallala Hoppsassa!", '4134_Kostentraegername' => "Test fuer Kostentraegername", ); $pdf->fillFormFields(%data ); $pdf->cleanoutput('test.pdf'); __END__ --- PDF_old.pm Thu Aug 15 05:08:26 2013 +++ PDF.pm Sat Jun 30 12:17:03 2018 @@ -4601,6 +4601,9 @@ $formdict->{Length} = CAM::PDF::Node->new('number', $len, $formonum, $formgnum); $formdict->{StreamData} = CAM::PDF::Node->new('stream', $text, $formonum, $formgnum); + delete $formdict-> { Filter }; + $self-> encodeObject( $formonum, 'FlateDecode' ); + if (@rsrcs > 0) { if (!$formdict->{Resources}) {