Problems with a checkbox, ...
Printed From: Debenu Quick PDF Library - PDF SDK Community Forum
Category: For Users of the Library
Forum Name: I need help - I can help
Forum Description: Problems and solutions while programming with the Debenu Quick PDF Library and Debenu PDF Viewer SDK
URL: http://www.quickpdf.org/forum/forum_posts.asp?TID=542
Printed Date: 22 Nov 24 at 6:10PM Software Version: Web Wiz Forums 11.01 - http://www.webwizforums.com
Topic: Problems with a checkbox, ...
Posted By: Devil
Subject: Problems with a checkbox, ...
Date Posted: 24 Oct 06 at 12:14PM
Hi,
the following source I used:
http://www.quickpdf.org/forum/forum_posts.asp?TID=232&PN=1&TPN=1
Now i add some checkboxes in it and fill out with this code:
Call QP.SetFormFieldValueByTitle(24, "Ja")
The Print Preview works fine, but the checkboxes cleared when you print the document, why ?
Could anyone help ?
Devil
|
Replies:
Posted By: bogey
Date Posted: 25 Oct 06 at 8:16AM
I always use the format of
QP.SetFormFieldValue(QP.FindFormFieldByTitle(fieldTitle),fieldValue)
when populating field values.
This works well for me. I don't know why the other method is causing a problem.
|
Posted By: Devil
Date Posted: 25 Oct 06 at 8:50AM
Hi bogey,
Call QP.SetFormFieldValue(24, "Ja")
or
Call QP.SetFormFieldValueByTitle("FeldName", "Ja")
doesn't work
It's always the same, you can see in the print Preview but when you print, all the checkboxes are empty !
The second problem i have with the checkboxes is that you cannot rotate the arrows in the checkboxes.
Call QP.SetFormFieldRotation(Feldindex, 90)
Call QP.SetFormFieldRotation(Feldindex, 180)
doesn't work
The arrows in the checkboxes have always the same position.
I used VB6, ,
can you give me a code sample for a chebox that do the following:
test.pdf open and fill out some Textfields and some checkboxes. Only the cheboxes must rotate over 90 angle. after this print out the complete sheet.
regrads
Devil
|
Posted By: bogey
Date Posted: 25 Oct 06 at 10:36AM
This is code that I use to complete fields on a form from a posted HTML form. I have not had problems with checkboxes.
fillTime = now() fieldCount = QP.FormFieldCount() fncDebug("<br>Field Count = " & fieldCount) 'for i = 1 to fieldCount ' fncdebug("<br>" & i & ". UpdateAppearanceStream: " & QP.GetFormFieldTitle(i) & " - result: " & QP.UpdateAppearanceStream(i)) ' fncdebug("<br>" & i & ". Readonly to False- Field : " & QP.GetFormFieldTitle(i) & " - result: " & QP.SetFormFieldReadOnly(i,0)) 'next
'default to fill fields unless specified as false if lcase(request("PDF~property~FillFormFields")) <> "false" then fncDebug("<hr>Merging posted form data into PDF and setting properties")
' Determine of the PDF fields should be marked as readonly. ' All fields will default to readonly if there it is not specified at the PDF level, ' if PDF~property~FormFieldsReadOnly if not specified or has a blank value, lock the fields ' or this can be overridden at the field level using a form element of fieldname~property~readonly with a value of "true" or "false" if len(request("PDF~property~FormFieldsReadOnly")) > 0 and instr("false no 0", lcase(request("PDF~property~FormFieldsReadOnly") ) ) > 0 then prefilledFormFieldsReadonly = false else 'default position if not specified otherwise prefilledFormFieldsReadonly = true end if fncDebug("<br> - Mark all prefilled form fields READONLY = " & prefilledFormFieldsReadonly )
for each item in request.form 'Check if properties need to be set on any form fields 'Format for form is "fieldname~property~property-type" with a value set to the value of the form element 'multi value form elements should be delimited with a comma, ie: (0.5,0.5,0.5)to set (color 50%, red 50% green, 50% blue) if instr(item,"~property~")>0 then select case lcase(split(item,"~")(2)) case "alignment" result = QP.SetFormFieldAlignment(QP.FindFormFieldByTitle(split(item,"~")(0)),request.form(item)) case "textsize" result = QP.SetFormFieldTextSize(QP.FindFormFieldByTitle(split(item,"~")(0)),request.form(item)) case "backgroundcolor" result = QP.SetFormFieldBackgroundColor(QP.FindFormFieldByTitle(split(item,"~")(0)),split(request.form(item),",")(0),split(request.form(item),",")(1),split(request.form(item),",")(2)) case "standardfont" result = QP.SetFormFieldStandardFont(QP.FindFormFieldByTitle(split(item,"~")(0)),request.form(item)) end select fncDebug("<br> - Property Setting <b>" & item & "</b> Datafield <b>" & split(item,"~")(0) & "</b> = <b>" & request.form(item) & "</b>, Results = <b>" & result & "</b>") elseif lcase(item) <> "pdfname" then 'if field exists in the pdf, insert matching data value from posted form result = QP.SetFormFieldValue(QP.FindFormFieldByTitle(item),request.form(item)) fncDebug("<br> - Datafield <b>" & item & "</b> = <b>" & request.form(item) & "</b>, Results = <b>" & result & "</b>") 'if field is supposed to be marked readonly and the field was populated, secure it if prefilledFormFieldsReadonly and result = 1 then fncDebug("<br> - Readonly <b>" & item & "</b> set = <b>true</b>, Results = <b>" & QP.SetFormFieldReadOnly(QP.FindFormFieldByTitle(item),1) & "</b>") end if end if next end if fncDebug("<br>Elapsed Time for Filling fields=" & dateDiff("S",fillTime,now()))
I have never worked with the rotated methods. If the Form is already in landscape mode, wouldn't the filling in data be landscaped? If you are mixing portrait and landscape text on the page, then the rotation may be needed.
|
Posted By: Devil
Date Posted: 25 Oct 06 at 11:30AM
Hello bogey,
thanks for your example. Unfortunately your example code does not have anything with to do after I searches,….
|
Posted By: bogey
Date Posted: 25 Oct 06 at 11:32AM
It is a sample of generically filling any pdf fields. This block will locate any matching fields in a pdf and fill with posted data. The technique works on text fields and checkboxes.
|
Posted By: Devil
Date Posted: 25 Oct 06 at 12:15PM
Helo bogey,
surely, but you have times tried to serve code with mine to use?
Private Sub Print_on_the_fly_Click()
' Sub to prints PDF Files on the fly without saving
Dim QP As iSed.QuickPDF
Set QP = CreateObject("iSED.QuickPDF")
' GDIPlus.dll needed that the images are printable 'on the fly Call QP.SetGDIPlusFileName(App.Path & "\GDIPLUS.DLL")
Call QP.UnlockKey("secret") Call QP.LoadFromFile(App.Path & "\Formular.pdf")
If QP.Encrypted = 1 Then QP.SetPassword ("secret") QP.Unencrypt End If Call QP.SetNeedAppearances(1)
Call QP.SetFormFieldValueByTitle("Datum", date) Call QP.SetFormFieldValueByTitle("Firma", Firma.value) Call QP.SetFormFieldValueByTitle("Name", Name.value) Call QP.SetFormFieldValueByTitle("Strasse", Strasse.value) Call QP.SetFormFieldValueByTitle("Ort",PLZ.value & " " & Ort.value) Call QP.SetFormFieldValueByTitle("Tel", Telfon.value) Call QP.SetFormFieldValueByTitle("Rueckruf", Rueckruf.value) 'Rueckruf Checkbox - Ja / Nein, default = Ja
' UpdateApperanceStream needed for printable 'on the fly For pdfFields = 1 To QP.FormFieldCount Call QP.UpdateAppearanceStream(pdfFields) Next pdfFields
Call QP.PrintDocument(QP.GetDefaultPrinterName, 1, 1, QP.PrintOptions(0, 0, "Formular"))
Set QP = Nothing End Sub
the codes works fine without the checkbox, when you use the checkbox and print the sheet the checkbox always clear.
|
Posted By: bogey
Date Posted: 25 Oct 06 at 1:11PM
What is the result returning from the SetFormFieldValueByTitle calls? Can you print them screen for debugging?
response.write QP.SetFormFieldValueByTitle("FeldName", "Ja")
Does it return a 1?
|
Posted By: Devil
Date Posted: 25 Oct 06 at 1:27PM
Hello bogey,
yes, response is "1", same response by the:
Call QP.SetFormFieldRotation(Index, 90) 'index = Field "Rueckruf"
|
Posted By: Devil
Date Posted: 25 Oct 06 at 7:41PM
Hi bogey,
Now it will be much kurioser than before, ...
When I save the pdf formular to to new file and open this file with acrobat, than all is ok.
The error expresses itself only with prints on the fly, ...
Devil
|
Posted By: marian_pascalau
Date Posted: 26 Oct 06 at 5:56AM
Hi, if you provide your Formular.pdf sample file I may test your problem. Post an URL or send your file to:
marian_pascalau(at)hotmail.com
PS. Du kannst auch in Deutsch schreiben.
Gruß, Marian
|
Posted By: bogey
Date Posted: 26 Oct 06 at 7:43AM
Devil wrote:
When I save the pdf formular to to new file and open this file with acrobat, than all is ok.
The error expresses itself only with prints on the fly, ... |
It sounds like the PDF is correctly created and the problem lies in the print driver. Can you try a different print driver?
|
Posted By: Devil
Date Posted: 26 Oct 06 at 9:41AM
Hi bogey,
not really, first Printer "HP LaserJet 2100" second printer "Canon ML370" on both printer same result !!!
|
Posted By: Devil
Date Posted: 26 Oct 06 at 9:44AM
marian_pascalau wrote:
Hi, if you provide your Formular.pdf sample file I may test your problem. Post an URL or send your file to:
marian_pascalau(at)hotmail.com
PS. Du kannst auch in Deutsch schreiben.
Gruß, Marian
|
Thanks Marian,
mail is oin the way, ....
Devil
|
|