Link to home
Start Free TrialLog in
Avatar of Mike Miazga
Mike MiazgaFlag for United States of America

asked on

.fdf to fill .pdf- need to modify .pdf

Hi all, I've got a very old .asp web application that prints to pdf.  I developed this app 13 years ago, and we've now come to record number 10,000 and I need to expand the record number field in the pdf to accommodate for the extra digit.  I've managed to find the file 'requisition.pdf' and I can edit it, I've moved things, expanded the field, but I don't see my modifications reflected in the application, when the pdf is created inside the application.  I move things around but everything stays the same in the app.  What am I missing here?  It's been 13 years and I'm struggling to remember how I did this.  

Some code (reqnum is the field in question):

Dim UserID
UserID = rsReqs("UserID")
strsql2 = "SELECT * FROM [User] Where UserID = '" & UserID & "'"
            set rsUser = Server.CreateObject("ADODB.Recordset")
            rsUser.Open strsql2, connDB, 1, 2
Dim User
User = rsUser("FN") & " " & rsUser("LN")
Set FdfAcX = Server.CreateObject("FdfApp.FdfApp")
Set outputFDF = FdfAcX.FDFCreate      
outputFDF.FDFSetValue "ReqNum", rsReqs("ReqNum"), False
outputFDF.FDFSetValue "UID", User, False       
outputFDF.FDFSetValue "DateEntered", rsReqs("DateEntered"), False       
outputFDF.FDFSetValue "DueDate", rsReqs("DueDate"), False
If rsReqs("Vendor2") = "" Then
outputFDF.FDFSetValue "Vendor", rsReqs("Vendor1"), False
Else
outputFDF.FDFSetValue "Vendor", rsReqs("Vendor2"), False
End If

(a lot more code in here)....

If rsReqs("qty19") > "0" then
outputFDF.FDFSetValue "qty19", rsReqs("qty19"), False
outputFDF.FDFSetValue "price19", "$" & rsReqs("price19"), False
outputFDF.FDFSetValue "desc19", rsReqs("desc19"), False
outputFDF.FDFSetValue "ls_Job19", rsReqs("ls_Job19"), False
outputFDF.FDFSetValue "GL19", rsReqs("GL19"), False
Else
outputFDF.FDFSetValue "desc19", rsReqs("desc19"), False
End IF
If rsReqs("qty20") > "0" then
outputFDF.FDFSetValue "qty20", rsReqs("qty20"), False
outputFDF.FDFSetValue "price20", "$" & rsReqs("price20"), False
outputFDF.FDFSetValue "desc20", rsReqs("desc20"), False
outputFDF.FDFSetValue "ls_Job20", rsReqs("ls_Job20"), False
outputFDF.FDFSetValue "GL20", rsReqs("GL20"), False
Else
outputFDF.FDFSetValue "desc20", rsReqs("desc20"), False
End IF

outputFDF.FDFSetFile "http://req.domainname.com/PDF/requisition.pdf"            

Response.ContentType = "application/vnd.fdf"
Response.BinaryWrite outputFDF.FDFSaveToBuf

outputFDF.FDFClose
'Response.Redirect("Http://req.Domainname.com/open_reqs.asp")
%>
Avatar of arnold
arnold
Flag of United States of America image

Where is the issue with record larger than 10000? You seem to be focusing on the output rather than the source of the record keeping is setup
I.e. A database where you have to change the record column to be larger than the 4 digits you seem to have now.
Can you post sample data highlighting where your issue is on the input side, or formatting on the output side.
If your requisition.pdf is a "template" used to populate, you have to adjust the PDF file enlarging the space where the record numbers would go.
Avatar of Mike Miazga

ASKER

It's only an issue with the output, the database is working fine.  I've tried to expand the field in the 'requisition.pdf' file and moved the top text to accommodate but I don't see my changes reflected.  User generated image
Is the PDF setup as a template that the fdf populates? Or do you have fdf find/replace references in the PDF?

Your issue is the layout/field overlap. One option you should consider is reducing the font size of the record number from looks like 12 to 10 and see if that lets a larger number fit in, another option is to eliminate the space between # record_number.

You would likely have to recreate the template of the PDF file used possibly adding company logo.
When I open the pdf in acrobat I get the options to edit form fields or document content.  I choose form fields and I've adjusted where It needs adjustment, but the changes don't appear in the application.. that's my issue.  I'm making these changes to "http://req.domainname.com/PDF/requisition.pdf" but they aren't appearing in the application.  I move text, but when I print the req through the browser the text isn't moved.  Any idea what I'm missing?User generated imageUser generated image
What changes to the fields are you able to do? Are you able to change font, font size, font color?
Try changing the color, just as a test to see if the fdf merely adds data through find/replace to it has/makes some ......

I.e. Change record number to red and see if your output will have the data in red or not.

Edit content, see if you can adjust the light slightly to make the record field a bit larger, change allignment to left from center. Or justify.
None of my changes are reflected!  This is my issue.  I change color, move text.  nothing is reflected when I print the req.
Then the template that is being used is not the one you reference

Open this file in a browser, "http://req.domainname.com/PDF/requisition.pdf" do you see the changes you made?
I.e. add a content entry updating /adding an entry at the bottom
I do see my changes when I browse to the document that way!  My changes are there!  So why would they not be reflected in the web app?  You see it pointing to this document in the fdf.asp file code I included, I see my changes when I browse to that file directly.  I'm really scratching my head.
Do you think there is caching happening on the server somehow?  I've rebooted, restarted the website and IIS.  I'm at a loss.
ASKER CERTIFIED SOLUTION
Avatar of arnold
arnold
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Copying the file to a newly named requisition2.pdf and changing the reference in the fdf.asp file to point to this new file fixed it!  Not sure why it didn't pick up the changes until then, but I've got it working now.  Thanks so much for your suggestions!
My guess is that fdf might cache/locally store the template to avoid making a request every time,

Glad I could help.
I think you're right.  I renamed the file back to requisition.pdf and repointed the fdf and it went right back to the old format.    Now I know.. thanks again!