B4A Library PDFjetB4A

mokrokuce

Member
Licensed User
Longtime User
Forgot to say I am using example from post #10.
 

LorenzoTRANSFEREX

Member
Licensed User
Longtime User
Hi,
I am reading all posts about PDFJet and I am not sure if it is possible adding a second page to PDF.
By the way, I'm not able to do it modifing the example code.
Is it a license problem or anything else?

Thanks
 

Descartex

Well-Known Member
Licensed User
Longtime User
Hi.
You can add more pages with

B4X:
PDFjetPDF1.AddPage(PDFPage1)
PDFjetPDF1.AddPage(PDFPage2)
PDFjetPDF1.AddPage(PDFPage3)
 

LorenzoTRANSFEREX

Member
Licensed User
Longtime User
Hi.
You can add more pages with

B4X:
PDFjetPDF1.AddPage(PDFPage1)
PDFjetPDF1.AddPage(PDFPage2)
PDFjetPDF1.AddPage(PDFPage3)

I'd tried but it doesn't work for me, I got an error with .AddPage method.

I solved the problem this way:

B4X:
  Dim PDFjetConstants1 As PDFjetConstants
   Dim PDFjetPDF1 As PDFjetPDF
   
   Dim PDFDestination As OutputStream
   PDFDestination=File.OpenOutput(File.DirRootExternal, "pdfjet-test.pdf", False)
   
   PDFjetPDF1.Initialize("PDFjetPDF1", PDFDestination)
   PDFjetPDF1.SetAuthor("Foo Bar")
   PDFjetPDF1.SetSubject("A simple pdf document")
   PDFjetPDF1.SetTitle("PDFjetB4A Example")
   
   Dim PDFPage As PDFjetPage
   Dim PDFPage2 As PDFjetPage   
   
   PDFPage.Initialize(PDFjetPDF1, PDFjetConstants1.PageSize.A4_PORTRAIT)
   'PDFjetPDF1.AddPage(PDFPage)

   Dim PDFFont1 As PDFjetFont
   PDFFont1.Initialize(PDFjetPDF1, PDFjetConstants1.CoreFont.TIMES_ROMAN)
   
   Dim PDFTextLine As PDFjetTextLine, PDFTextLine2 As PDFjetTextLine
   PDFTextLine.Initialize(PDFFont1)
   PDFTextLine.SetPosition(10, 10+PDFFont1.GetHeight)
   PDFTextLine.SetText("First line test.")

   PDFTextLine2.Initialize(PDFFont1)
   PDFTextLine2.SetPosition(10, 10+PDFFont1.GetHeight*2)
   PDFTextLine2.SetText("Second line test.")   
   PDFTextLine.DrawOn(PDFPage)   
   PDFTextLine2.DrawOn(PDFPage)       

   PDFPage2.Initialize(PDFjetPDF1, PDFjetConstants1.PageSize.A4_PORTRAIT)   

   PDFTextLine.DrawOn(PDFPage2)
   PDFTextLine2.DrawOn(PDFPage2)   
   
   PDFjetPDF1.Close

As you can see, I only use PDFPage2.Initialize to get the second page.
The order of execution is very important, first initialize and set texts of first page, then initialize and set texts of second page, and so on.

Thanks
 

Descartex

Well-Known Member
Licensed User
Longtime User
You have to add the pages after filling it.
 

DonManfred

Expert
Licensed User
Longtime User
PDFjetB4A is a PDF document authoring library for B4A

PDFjetB4A wraps the PDFjet for Java library from pdfjet.com.
Here are some of it's features:

May i ask you to share the wrapper code with me?

I today bought a PDFJet-License (v5.90) and i would like to adapt the wrapper to this Version.

I can share the new Wrapper-code back if you want. I also can use it for MY use only.
 

Phayao

Active Member
Licensed User
Longtime User
I also like to thank for this phantastic library !
Nevertheless I suddenly got a problem which came without changing anything in my pdf output part of my program:
java.lang.Exception: Sub pdfjetpdf1_closecomplete was not found.

Though the sub PDFjetPDF1_closecomplete(Success as boolean) has been there all the time.
The error occurs after PDFjetPDF1.Close in my CreatePDFTable sub.

The whole code to post would be very lengthy - but now I'm desperate and wondering if anybody else encountered this problem.

Has anything changed in the library ? I'm using the 1.10 version from post #1.

Any help is very much appreciated,

Chris


PS: I found the error: the Sub PDFjetPDF1_closecomplete HAS TO BE in the main activity because the program goes through Activity_Resume.
I cannot understand how it worked before, but now it's obviously like that.
 
Last edited:

MarcoRome

Expert
Licensed User
Longtime User
Hi Warwound how are you.
A question, can you share your wrapper PDFJet sources with me ?
Thank you in advance and have a nice day
Marco
 

DonManfred

Expert
Licensed User
Longtime User
How could I upload data from a database and display it in a PDF file?
Read the Data from your Database and use the Methods of the Lib to create a PDF (or even more than one) out of them.
There is no ready/buildIn method to do this inside the lib; must be done by yourself.
 

abosalaheldin

New Member
Is it possible to get the output which is sent to bluetooth thermal printer and print it to pdf file instead. If it is possible please give answer in detail becaue I'm beginner in b4a programming. Thank you.
 

DonManfred

Expert
Licensed User
Longtime User
Cookies are required to use this site. You must accept them to continue using the site. Learn more…