Do you own a Debenu Quick PDF Library version 7, 8, 9, 10, 11, 12, 13 or iSEDQuickPDF license? Upgrade to Debenu Quick PDF Library 14 today!

Debenu Quick PDF Library - PDF SDK Community Forum Homepage
Forum Home Forum Home > For Users of the Library > General Discussion
  New Posts New Posts RSS Feed - Form Field Border Line (Visible)
  FAQ FAQ  Forum Search   Register Register  Login Login

Form Field Border Line (Visible)

 Post Reply Post Reply
Author
Message
jabaltie View Drop Down
Senior Member
Senior Member
Avatar

Joined: 08 Nov 05
Location: Brazil
Status: Offline
Points: 138
Post Options Post Options   Thanks (0) Thanks(0)   Quote jabaltie Quote  Post ReplyReply Direct Link To This Post Topic: Form Field Border Line (Visible)
    Posted: 08 Jun 06 at 8:48AM
I used NitroPDF (as Chicks suggested) to create PDF with form fields. I have only to text form fields on my PDF.

When I open the PDF on Acrobat, border lines are not visible. This is what I want. I can fill in the form field contents. It's OK.

However, when I stuff data into the PDF using QuickPDF, the resulting PDF opens up with visible border lines.

Would it be because I'm flattening form fields ?

Any hints ?

This is the original PDF template :

http://www.DES.online.unimep.br/au/pub/nitro.pdf

And here's a copy of a PDF after QuickPDF :

http://www.DES.online.unimep.br/au/pub/quick.pdf

Back to Top
chicks View Drop Down
Debenu Quick PDF Library Expert
Debenu Quick PDF Library Expert


Joined: 29 Oct 05
Location: United States
Status: Offline
Points: 251
Post Options Post Options   Thanks (0) Thanks(0)   Quote chicks Quote  Post ReplyReply Direct Link To This Post Posted: 08 Jun 06 at 12:49PM
Dang! Looks like iSEQuickPDF simply doesn't support borderless fields, unless I'm overlooking something.

There are a couple of ways to fix this:

1. (the hard way) Save the form field attributes (position, font, colors, etc.) to a file, delete the form fields, then write the text using the saved information. See this example:

http://forum.planetpdf.com/webboard/wbpx.dll/read?104606,3e

2. (the easy way) Create a .fdf with your data in it, and use pdftk to fill and flatten the fields. There will be no borders. See this example:

http://www.savefile.com/files.php?fid=5838135

I have a DLL that uses the same techniques as pdftk (gcj-compiled iText java lib), if you would prefer to integrate the flattening, instead of using a command-line tool. See these links:

http://www.savefile.com/files.php?fid=9411235
http://www.savefile.com/files.php?fid=5312447


Edited by chicks
Back to Top
jabaltie View Drop Down
Senior Member
Senior Member
Avatar

Joined: 08 Nov 05
Location: Brazil
Status: Offline
Points: 138
Post Options Post Options   Thanks (0) Thanks(0)   Quote jabaltie Quote  Post ReplyReply Direct Link To This Post Posted: 08 Jun 06 at 1:03PM
Originally posted by chicks chicks wrote:

Dang! Looks like iSEQuickPDF simply doesn't support borderless fields, unless I'm overlooking something.


Yes, it DOES support. Because I usually build my templates using Open Office version 2.0. And it has a button to export directly to PDF, without printer drivers or any other accessories.

When I draw templates at Open Office, I can make the form fields without borders and the PDF will respect this, as well as iSEDQuickPDF.

And, OO is free !

However, the "Oh Oh" problem with OO is that when I add a background image, the form fields will create a white hole over the backround image.

I mean, I have not figured out a way to make "transparent" form fields, is NitroPDF does !

As for the suggestions purposed, the data filling process is pretty well settled down with iSedQuickPDF. I dont wanna mess around with it.

So, guess we're back with two (or three) questions :

1) Using NitroPDF (that respects the background), how to remove the borders around the fields ?

or

2) Using OO, how to make form fields that respect the background image ?

or

3) A simple, cheap way to create sophisticated PDF templates...


Thanks again 4 your support !
Back to Top
chicks View Drop Down
Debenu Quick PDF Library Expert
Debenu Quick PDF Library Expert


Joined: 29 Oct 05
Location: United States
Status: Offline
Points: 251
Post Options Post Options   Thanks (0) Thanks(0)   Quote chicks Quote  Post ReplyReply Direct Link To This Post Posted: 08 Jun 06 at 1:08PM
Well, you can probably simplify the "hard" way above, which uses iSEDQuickPDF. You can probably do it dynamically - loop through all the form fields, save their attributes into some sort of array. Then delete the form fields completely. Then use the saved attributes to write your data onto the PDF where the form fields were.

Back to Top
jabaltie View Drop Down
Senior Member
Senior Member
Avatar

Joined: 08 Nov 05
Location: Brazil
Status: Offline
Points: 138
Post Options Post Options   Thanks (0) Thanks(0)   Quote jabaltie Quote  Post ReplyReply Direct Link To This Post Posted: 08 Jun 06 at 1:57PM
Looks like I've found a bug on iSedQuickPDF...

Have a look at the very, very simple script below :

============================
OPTION EXPLICIT
DIM objQPDF
Set objQPDF = WScript.CreateObject("ISED.QUICKPDF")
WScript.Echo "UnlockKey ",objQPDF.unlockkey("put-your-key-here")
WScript.Echo "Load File ",objQPDF.LoadFromFile("C:\TEST\WSH\NITRO.PDF")
WScript.Echo "set form f",objQPDF.SetFormFieldValue(2,"Lecture - BioDiesel and Sugar Cane Engines")
WScript.Echo "set form f",objQPDF.FlattenFormfield(2)
WScript.Echo "set form f",objQPDF.SetFormFieldValue(1,"ADRIANO")
WScript.Echo "set form f",objQPDF.FlattenFormfield(1)
WScript.Echo "save      ",objQPDF.SaveToFile("C:\TEMP\NITRO.PDF")
================================================

You can grab a copy of NITRO.PDF from here :

http://www.DES.online.unimep.br/au/pub/nitro.pdf

What's up anyway ?

Try to play around with Flattening. If you DO NOT flatten, it will work.

If you Flatten however, the border will come up.

Is it a problem on IsedQuickPDF or not ?
Back to Top
chicks View Drop Down
Debenu Quick PDF Library Expert
Debenu Quick PDF Library Expert


Joined: 29 Oct 05
Location: United States
Status: Offline
Points: 251
Post Options Post Options   Thanks (0) Thanks(0)   Quote chicks Quote  Post ReplyReply Direct Link To This Post Posted: 08 Jun 06 at 4:52PM
OK, here's a simplified version of option 1 above. It will loop through the fields, get the applicable attributes of the fields, delete the fields, and write text where the field was, using the attributes. Just change the array to read from a file, and you should be good to go...

(vbscript)

Option Explicit

Dim QP, i
Dim inFileName, outFileName
Dim x, y, w, h
Dim red, green, blue
Dim Value, FontName, FontSize, FontColor, Alignment, MaxLength
Dim QuickPDFKey
Dim fontID(14)
Dim a

'-- Init iSedQuickPDF
Set QP = CreateObject("iSED.QuickPDF")

'-- Set file names
QuickPDFKey = WScript.Arguments(0)
inFileName = "nitro.pdf" 'WScript.Arguments(1)
outFileName = "filled.pdf" 'WScript.Arguments(2)

'-- Unlock the PDF library
Call QP.UnlockKey(QuickPDFKey)

'-- Load the input PDF
If QP.LoadFromFile(inFileName) = 0 Then
     WScript.Echo("Could Not Load PDF File: " + inFileName)
     WScript.Quit(Err)
End If

a = Array("ADRIANO", "Lecture - BioDiesel and Sugar Cane Engines" & vbCrLf & "Another line" & vbCrLf & "Another line")

WScript.Echo "Creating " & outFileName

'-- Loop through PDF Form fields
For i = QP.FormFieldCount To 1 Step -1

    '-- Get the field attributes
    x = QP.GetFormFieldBound(i, 0)
    y = QP.GetFormFieldBound(i, 1)
    w = QP.GetFormFieldBound(i, 2)
    h = QP.GetFormFieldBound(i, 3)

    FontName = QP.GetFormFieldFontName(i)
    FontSize = QP.GetFormFieldTextSize(i)
    Call QP.SetTextSize(FontSize)
    setFont(FontName)

    red   = QP.GetFormFieldColor(i,1)
    green = QP.GetFormFieldColor(i,2)
    blue = QP.GetFormFieldColor(i,3)

    Call QP.SetTextColor(red,green,blue)

    Alignment = QP.GetFormFieldAlignment(i)
    Call QP.SetTextAlign(Alignment)

    '-- Make sure textbox is high enough for font
    If h <= FontSize Then h = FontSize + 2

    '-- Delete the form field
    Call QP.DeleteFormField(i)

    '-- Draw the text where form field was
    Value = a(i-1)
    Call QP.DrawTextBox(x, y, w, h, Value, 0)
Next

Call QP.CompressContent()

'-- Save document to PDF File
Call QP.SaveToFile(outFileName)

'-- Clean up
Set QP = Nothing

'-- We're Done!
WScript.Quit(Err)

Sub setFont(FontName)

     Select Case FontName
          Case "Courier"
               SelectFont(0)
          Case "Courier-Bold"
               SelectFont(1)
          Case "Courier-BoldOblique"
               SelectFont(2)
          Case "Courier-Oblique"
               SelectFont(3)
          Case "Helvetica"
               SelectFont(4)
          Case "Helvetica-Bold"
               SelectFont(5)
          Case "Helvetica-BoldOblique"
               SelectFont(6)
          Case "Helvetica-Oblique"
               SelectFont(7)
          Case "Times-Roman"
               SelectFont(8)
          Case "Times-Bold"
               SelectFont(9)
          Case "Times-Italic"
               SelectFont(10)
          Case "Times-BoldItalic"
               SelectFont(11)
          Case "Symbol"
               SelectFont(12)
          Case "ZapfDingbats"
               SelectFont(13)
          Case Else
               SelectFont(0)
     End Select

End Sub

Sub SelectFont (fontNumber)

     If fontID(fontNumber) = "" Then
          fontID(fontNumber) = QP.AddStandardFont(fontNumber)
     End If

     Call QP.SelectFont(fontID(fontNumber))

End Sub

Back to Top
jabaltie View Drop Down
Senior Member
Senior Member
Avatar

Joined: 08 Nov 05
Location: Brazil
Status: Offline
Points: 138
Post Options Post Options   Thanks (0) Thanks(0)   Quote jabaltie Quote  Post ReplyReply Direct Link To This Post Posted: 19 Jun 06 at 8:27AM
Hello Chicks

Once more, thank you for your attention.

Sorry but I thought what you suggested too complicated. My field merging process is very well settled down and I dont wanna mess around with it. Just for you to have an idea : data comes as a XML file and is stuffed into the PDF. Data comes from web or even from a Unisys mainframe - after all, it is a simple XML file.

Anyway, I solved the problem another way : for this specific case, I cant use the Open Office embeded conversion button (it has a button to export to PDF directly inside).

Then, I used Adobe Professional. Using it, everything works fine.

The problem it creates for me is that Open Office is free and I can use anywhere. Adobe PRO is not. I have only a single license. So I have to convert it THERE , on the machine where I have it installed.

Anyway, for other 99% situations, I can use Open Office directly.
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 11.01
Copyright ©2001-2014 Web Wiz Ltd.

Copyright © 2017 Debenu. Debenu Quick PDF Library is a PDF SDK. All rights reserved. AboutContactBlogSupportOnline Store