Solved

Using "raw" FDF to insert an image with pdftk.exe

Posted on 2014-02-28
7
1,270 Views
Last Modified: 2014-03-13
We are currently using "raw" fdf, such as the following:

<< /V (51)/T (field_146) >>
<< /V (STRING)/T (field_148) >>
<< /V (7353)/T (field_149) >>
<< /V (HELLO WORLD)/T (field_150) >> 

to populate form fields on a PDF form, in conjunction with the pdftk.exe  executable. We
also have a certain image (which will change in nature for each separate PDF generated) that needs to be inserted as well.

I was trying to insert it as the image on a button (AP, or APRef, was it????) but evidently that isn't going to work unless I make it some kind of "template", which I hope I can do with this raw FDF and pdftk.exe.

Any ideas? I would think this should be simple and straightforward enough to do with the raw FDF, especially since the image is in a ready PDF file itself.
0
Comment
Question by:jristov
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
7 Comments
 
LVL 54

Assisted Solution

by:Joe Winograd, EE MVE
Joe Winograd, EE MVE earned 500 total points
ID: 39895682
I've used PDFtk Server (which is the PDFtk.exe command line executable) in many programs and it has always worked well, although I've never used any of its FDF features. My first thought would be to use the <generate_fdf> operation, which is documented here:
http://www.pdflabs.com/docs/pdftk-man-page/

If you have tried this and it doesn't work, how is it failing? Regards, Joe
0
 

Author Comment

by:jristov
ID: 39896271
Well, I tried the generate_fdf option to produce an fdf from the PDF file containing the image, and got only an empty output, as follows:

%FDF-1.2
%âãÏÓ
1 0 obj
<<
/FDF
<<
/Fields []
>>
>>
endobj
trailer

<<
/Root 1 0 R
>>
%%EOF

I'll go ahead and try it a few other ways and report what I find.....
0
 
LVL 54

Expert Comment

by:Joe Winograd, EE MVE
ID: 39897394
Sounds good. In the meantime, I'll try some experiments on my end.
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:jristov
ID: 39910260
OK, some success: using the flatten option with pdftk, we were able to get the image and the text fields onto the form at the same time like we needed. Since you pointed me in the right direction, I'm willing to give at least some points; however, we also have a new difficulty.

We would really like the finished PDF to have a button on it that can be clicked to Activate printing, but as you know after you've <Flattened> the form fields in the final product they're no longer interactive. Know of any way we can get around this?
0
 
LVL 54

Accepted Solution

by:
Joe Winograd, EE MVE earned 500 total points
ID: 39910837
It's no problem to add a button to a flattened PDF. I just tested it in Acrobat X Standard...created a button on an image-only PDF and set the button's action to File>Print — worked perfectly! Are you OK with using Acrobat to do it? If not, I'm sure there are other products besides Acrobat that can do it, but PDFtk cannot, AFAIK. Regards, Joe
0
 

Author Comment

by:jristov
ID: 39910899
Unfortunately I don't mean using Acrobat Professional to manually put on a button. It must be a part of the PDF that has already combined the image and the regular PDF, after flattening, and must happen in some automatic way similar to pdftk.

Though, I haven't tested every possibility yet, I admit.
0
 
LVL 54

Expert Comment

by:Joe Winograd, EE MVE
ID: 39915024
I know of two libraries that can do this — ByteScout and iTextSharp. I've used the ByteScout library to extract text from PDFs and it works well, but I've never used it to add a push button into a PDF form. However, based on my experience with the text extractor, I think it's worth a try:
http://bytescout.com/products/developer/pdfsdk/bytescoutpdf_push_button_for_pdf_form.html

For the iTextSharp libarary, here's a link that discusses it:
http://stackoverflow.com/questions/9193145/adding-button-in-a-pdf-file-using-itextsharp

Note the reference to Chapter 8 of the manual:
http://itextpdf.com/book/chapter.php?id=8

I haven't used iTextSharp, but it's a well-regarded PDF library that is very popular with programmers. Regards, Joe
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

In a previous article published here at Experts Exchange, Signature Image with Transparent Background (http://www.experts-exchange.com/Web_Development/Document_Imaging/A_12380-Signature-Image-with-Transparent-Background.html), I explained how to cre…
Inserting page numbers in Portable Document Files not only enhances manageability but also makes them look professional. With numbered pages, the file appears more organized and it becomes easier to search for a particular page. The size and the vol…
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
We often encounter PDF files that are pure images, that is, they do not have text characters, but instead contain only raster graphics. The most common causes of this are document scanning software and faxing software/services that create image-only…

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question