At this node lots of folks spoke of diferent ways in which they were able to manipulate PDF's and overwrite them with user or database driven data.

In fact, I reported success in my own experiment in that realm. But now I have a pdf generated using scribus, which I need to overwrite with a small piece of unique data.

Will the source of a PDF file or how it is initially created going to determine whether I can add text on top of an existing design?

-- Hugh

UPDATE:

OK, so here is the code I'm working with, currently reads more or less:

#!/usr/bin/perl -w use strict; use warnings; use PDF::API2; my $TEMPLATE = '/path/to/scribus/generated/pdffile.pdf'; my $RESULT_PDF = '/path/to/script/generated/pdf_result_file.pdf'; my $INSTANCE = 'Print this code on form'; my $pdf = PDF::API2->open($TEMPLATE); my $page = $pdf->openpage('1'); my $text = $page->text(); my $font = $pdf->corefont('Helvetica'); # prepare text object $text->font($font,48); # Set font to Helvetica, 11pt $text->fillcolor("#222222"); # This is black $text->translate(173,660); # Text start location for Corp chk box $text->text("$INSTANCE"); # Print "X" at 173,660 $pdf->saveas($RESULT_PDF); $pdf->end; # print status message: print STDERR "Efforts to automate pdf generation still under developme +nt.\n"; print STDERR "For the moment, please do this manually. Thanks.\n";
But I also have commented out, an attempt to use PDF::Reuse, as well.

if( $lal && $lol ) { $life++; }

In reply to Adding text to existing pdf file. by hesco

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.