Hi all,
I already mentioned that the help file focuses a lot on the command line and rather not on the DLL didn't I?
Ok, I have a PDF form and try to set programatically some value in a field. The only function barely suggesting this seems to be setFDFField() except for the fact that:
- it talks about a FDF which I'm NOT using (PDF form though)
- it doesn't specify the calling parameter format (is it the weird FDF syntax string? can't that be wrapped in something friendlier like field name and value? what about if I'm not using a FDF?)
I'm not a PDF crack so it might be that FDF - PDF is the same thing. But maybe not, so I'm left here with the guesswork... so to sum it up I need to:
1. load a PDF form (that's the easy part, I can do that)
2. optional: read all the field names from it (getting a FDF file out of my PDF form then juggling with it is not an option, I'm not into weird conversions)
3. set some field values in it once I know the field names
4. whatever - merge it usually (this part I also know already)
Thanks a lot for your suggestions,
M
(12-14-2009 10:51 AM)mario_pdf Wrote: [ -> ]Hi all,
I already mentioned that the help file focuses a lot on the command line and rather not on the DLL didn't I?
Ok, I have a PDF form and try to set programatically some value in a field. The only function barely suggesting this seems to be setFDFField() except for the fact that:
- it talks about a FDF which I'm NOT using (PDF form though)
- it doesn't specify the calling parameter format (is it the weird FDF syntax string? can't that be wrapped in something friendlier like field name and value? what about if I'm not using a FDF?)
I'm not a PDF crack so it might be that FDF - PDF is the same thing. But maybe not, so I'm left here with the guesswork... so to sum it up I need to:
1. load a PDF form (that's the easy part, I can do that)
2. optional: read all the field names from it (getting a FDF file out of my PDF form then juggling with it is not an option, I'm not into weird conversions)
3. set some field values in it once I know the field names
4. whatever - merge it usually (this part I also know already)
Thanks a lot for your suggestions,
M
Again, confused on what your asking for. See the "data files" section in PDF Meld docs. It may clear up for you as to what you need to populate the fdf fields for a document.
Pat Gorney
pgorney@fytek.com
(12-14-2009 12:08 PM)pgorney Wrote: [ -> ]Again, confused on what your asking for. See the "data files" section in PDF Meld docs. It may clear up for you as to what you need to populate the fdf fields for a document.
I am asking about PDF Forms, NOT FDF files. Are you trying to tell that FDF=PDF Form? Or that I MUST use FDF to fill into a PDF Form? Because I don't want to use a FDF, it looks bad and primitive and dirty.
Hi, any update here?
Sorry to insist, but if even you the developers cannot tell how to use the product, why would one buy it???
(01-27-2010 07:21 AM)mario_pdf Wrote: [ -> ]Hi, any update here?
Sorry to insist, but if even you the developers cannot tell how to use the product, why would one buy it???
No updates.. What does your fillable pdf form look like? Send us a copy of it.
Pat Gorney
Fytek, Inc.
Hi.
Waiting for the update............
(01-28-2010 05:56 AM)pgorney Wrote: [ -> ]No updates.. What does your fillable pdf form look like? Send us a copy of it.
It's no special PDF: I go into Acrobat, create a PDF form with a text field, then save it. No use to attach it: I have no issues with some file, but I can't find the WAY of filling form fields. Look, I could work very well with iText like this:
Code:
PdfReader initReader = new PdfReader(sourcefiles[f]);
ByteArrayOutputStream dest = new ByteArrayOutputStream();
PdfStamper stamper = new PdfStamper(initReader, dest);
AcroFields form = stamper.getAcroFields();
form.setField( "Text2", "Cghvfuklasd lkc kls232323" );
Now how do I achieve the above with PDFMeld? In C++ of course.
(02-01-2010 07:34 AM)mario_pdf Wrote: [ -> ] (01-28-2010 05:56 AM)pgorney Wrote: [ -> ]No updates.. What does your fillable pdf form look like? Send us a copy of it.
It's no special PDF: I go into Acrobat, create a PDF form with a text field, then save it. No use to attach it: I have no issues with some file, but I can't find the WAY of filling form fields. Look, I could work very well with iText like this:
Code:
PdfReader initReader = new PdfReader(sourcefiles[f]);
ByteArrayOutputStream dest = new ByteArrayOutputStream();
PdfStamper stamper = new PdfStamper(initReader, dest);
AcroFields form = stamper.getAcroFields();
form.setField( "Text2", "Cghvfuklasd lkc kls232323" );
Now how do I achieve the above with PDFMeld? In C++ of course.
There are several methods that can be used to fill in or extract form field information in PDF Meld.
Say you have a PDF with a field called Text2 and you want to set the value to abc123. You can do something like this:
ostringstream sstr;
sstr << "<< /T (Text2) /V (abc123) >>";
string sFdfLine = sstr.str();
_bstr_t thing = m_pPDF->setFDFField( sFdfLine.c_str() );
_variant_t outval = m_pPDF->buildPDF();
Note the parenthesis around the field name (Text2) and the value (abc123) above. Use a slash in front of any parenthesis in the value if you want to use it as a literal. Like this: (my \(text\))
setFDFField sets one or more fields so you can pass something like this to set 2 fields:
sstr << "<< /T (Text2) /V (abc123) >> << /T (Text3) /V (myvalue) >> ";
or you may call setFDFField multiple times with different name/value pairs.
Other methods you may want to use are:
setFDFFileIn(path-file) - set to the path and name of a file on disk containing the field/values. This loads in the values from an existing file on disk.
setFDFFileOut() - creates an FDF file based on the input PDF. In this case, your output file (set with setOutFile) should have an extension of .fdf. You can then modify the file and load it in with setFDFFileIn.
getFDFFields() - returns the FDF file from the input PDF. Call this method after you call buildPDF however as buildPDF is what reads through the input PDF and performs the processing. This gives you the current fields/values as a variable you can use in your code then pass it back into the PDF using setFDFField. You only need to use this method if you need to read the fields/values before making changes.
Regards,
Mike Bernardo
FyTek, Inc.
Here's the test code I use:
Quote:IPDFMeldPtr pTestPDF(__uuidof(PDFMeld));
pTestPDF->setKeyName( "mykey" );
pTestPDF->setKeyCode( "mycode" );
pTestPDF->setInFile (_bstr_t(L"C:\\filein.pdf"));
pTestPDF->setOutFile (_bstr_t(L"c:\\fileout.pdf"));
_bstr_t outval = pTestPDF->buildPDF (); // THIS ONE RETURNS code -10 ???
_bstr_t allfields = pTestPDF->getFDFFields(); // THIS ONE RETURNS "" - EMPTY STRING???
_bstr_t thefield = pTestPDF->setFDFField("<< /T (Text2) /V (abc123) >>"); // THIS ONE DOES NOTHING VISIBLE, RETURNS MY FDF STRING
_bstr_t fieldval = pTestPDF->buildPDF (); // OR HOW ELSE DO I SAVE BACK THE RESULTS OF ABOVE OPS???
Pat has already the sample input file I'm using. What am I doing wrong?