[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1455
  • Last Modified:

gen_PDF

We have an old PB application that generates a PDF document. We are not sure how. Does Powebuilder have a built-in PDF generator or POSTSCRIPT genrator. Someone mentioned it might use a ghostscript software to convert and generate the PDF.

2. is there a way to confirm how the application is generating the PDF by looking at the code associated with the button "CREATE PDF".

3. If application is using ghostscipt is this one exe that we need to ahve installed on the PC?
0
sam15
Asked:
sam15
  • 12
  • 6
  • 4
  • +1
3 Solutions
 
sandeep_patelCommented:
it can be ghostscript or third party controls or some pdf printer dlls. check the code in that button and will have an idea. otherwise paste the code here for experts to look in detail

Regards,
Sandeep
0
 
sam15Author Commented:
I attached the code for button. So powerbuilder 10.5 does not have any way to generate PDF or postscript files?
invoice.txt
0
 
diasroshanCommented:
Hi,

Your application uses the XSL-FO method to generate PDF.
If your application uses the XSL-FO method, you must distribute Apache FOP files and the Java Runtime Environment (JRE) with your application.

If your application uses the Apache processor to save as PDF or XSL-FO, you must deploy the fop-0.20.4 directory and the Java Runtime Environment (JRE) with your application.

They must be deployed in the same directory as the PowerBuilder runtime files. For example, if you deploy your application and pbvm105.dll and the other PowerBuilder runtime files in a directory called MyApplication, the Apache processor and the JRE must be deployed in MyApplication/fop-0.20.4 and MyApplication/jre. However, you do not need to place a copy of the JRE in this location if the full JDK is installed on the target computer and is in the classpath.

Just check if the following JAR files are in the user's classpath:
fop-0.20.4\build\fop.jar
fop-0.20.4\lib\batik.jar
fop-0.20.4\lib\xalan-2.3.1.jar
fop-0.20.4\lib\xercesImpl-2.1.0.jar
fop-0.20.4\lib\xml-apis.jar
fop-0.20.4\lib\avalon-framework-cvs-20020315.jar

Cheers,
Rosh
0
Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
LordainCommented:
I don't know how old of version you are using in PB but I personally use the SAVEAS method.

Concept:
arg_dw.SAVEAS(arg_path, PDF!, arg_header)

Example:
dw_1.SaveAs("C:\myfilename.pdf", PDF!, True)
0
 
sam15Author Commented:
What is XSl-FO? is that a java or apache application used to generate PDF files from PB applications?

We use PB 10.5? Can PB save a datawindow directly into PDF format.

This is an old code. Is it badly written code or i am just confused by it.
0
 
LordainCommented:
Yes you can save the contents of your DW directly into PDF format using the saveas method as I gave.

Make a command button and in the clicked event code my example.

reference the name of your dw.  In my example I named it dw_1

Save the file with the full path name of where and what you want to call it.  Make sure to include the .pdf like my example has.

The PDF! is an enumerated type inside of PB so you can use it as it.

If you want the header then set to TRUE otherwise False.

I cannot be certain this code is in PB 10.5 but you should be able to check the help files and it should tell you want is supported.

0
 
sam15Author Commented:
anothe thing i forgot to mention

I looked in the application directory that i have and there was no subdirectory with FOP-xx.xxx there.

However i found all the file you refer to under
c:/program files/sybase/shared/powerbuilder/fop-0.20.4/build
                                                                                         /col
                                                                                       /lib

Why would someone use FOp whrn it is simple in PB to create a PDF file using the saveas command.
Was this PDF generation using save as a new feature?
0
 
LordainCommented:
I believe the difference is one (saveas) is better for windows and the other for Java.
0
 
sam15Author Commented:
I am little confused by this code. It seems to use XSLFOP and saev_as based on these lines?

                   // Create and place the PDFs
                  dw_detail_invoice_csdt.Object.DataWindow.Export.PDF.Method = XSLFOP!
                  rtn = dw_detail_invoice_csdt.SaveAs(ls_pdf_filename, PDF!, FALSE)
//                  rtn = dw_detail_invoice_csdt.SaveAs(ls_pdf_filename, PDF!, FALSE)
0
 
sam15Author Commented:
I found there are two windows for this PDF. I think the production one is only using SAVEAS.

Does this mean PB is creating the PDF and there is no need for any libraries?
Can this be using Ghostscript to open the PDF created. I understand there were issues with adobe for some reason.
0
 
sandeep_patelCommented:
0
 
sam15Author Commented:
so you use XSLFOP to export the data window to PDF and then SaveAs to save it to the PDF file. is this correct?
Is this the standard way of doing it in PB.

The other thing is that they need to open the PDF file using some reader. Will Adobe or Ghost script used for that.
0
 
LordainCommented:
It is a standard but not sure I would say it is the standard.  I don't use XSLFOP but it is platform independant so it is more robust.  All of my apps are on the windows platform but if I needed to support multiple platforms I would probably choose this method.

I am able to open all of my PDF files using adobe reader which is free.
0
 
sam15Author Commented:
so ur saying on a windows platform you can have the PB application do this

dw_1.SaveAs("C:\myfilename.pdf", PDF!, True)

which would generate a PDF file on the local drive - no executables needed

and then user will open it just like any PDF formatted file which is adobe reader.
0
 
LordainCommented:
Yes
0
 
sandeep_patelCommented:
To open pdf file you can embed Microsoft OLE web browser control on your window and use below code to display the file..

ole_name.navigateurl('c:\temp\file1.pdf')

Regards,
Sandeep
0
 
sam15Author Commented:
We would like to use standard adobe. would microsoft open it in web browser.

Do you think application dependency on Ghostscript now is that it is creating a Postscript file and then converting that to PDF.
0
 
sam15Author Commented:
loradin

if you check this, you will see that PB needs to export the file to postscript before it generates th PDF file. Are you using any tool for interpreting the postscript file

http://infocenter.sybase.com/help/index.jsp?topic=/com.sybase.help.pb_10.5.dwref/html/dwref/CHDDAFHF.htm
0
 
sandeep_patelCommented:
You can use Web browser control to launch any web page in your PB window. It will launch internet explorer within it. YOu just need to give path of that file instead of any URL and it will display the pdf within that control. you just need to

Insert > OLE > insert control tab > select Microsoft web browser and write above code to display pdf within it.
0
 
LordainCommented:
We did implement ghostscript in the past.  I didn't think it was still required but it still be using it.  We have upgarded PB a few times since implementing it.
0
 
sam15Author Commented:
I think if you remove gohstscript from your machines it may stop working.

but this is the issue. we don;t want to use ghost script.

If i udnerstand this correctly we can wither use:
1)  XSL-FO but that requires to install the java libraries
2) microsoft ole web browser control

is this correct? but still i do not udnerstand why Adobe wont work instead of the above options.
0
 
sam15Author Commented:
if i understand this correctly, PB has two options or creating and printing a PDF: XSL-FO or creating a postscript and distilling to PDF. IT seems the distill thing where it needs the ghostscript. do you agree?

Export.PDF.Method
Description
Setting that determines whether data is exported to PDF from a DataWindow object by printing to a PostScript file and distilling to PDF, or by saving in XSL Formatting Objects (XSL-FO) format and processing to PDF.

Applies to
0
 
sam15Author Commented:
It seems you are either stuck with Ghstscript or XSL-FO files for PDF generation.

Deployment requirements
If your application uses the distill method, you must distribute the GNU Ghostscript files and default PostScript printer driver and related files (if using the default printer) with your application. If your application uses the XSL-FO method, you must distribute Apache FOP files and the Java Runtime Environment (JRE) with your application. For more information, see the chapter on deploying your application in Application Techniques.


0

Featured Post

[Webinar] Kill tickets & tabs using PowerShell

Are you tired of cycling through the same browser tabs everyday to close the same repetitive tickets? In this webinar JumpCloud will show how you can leverage RESTful APIs to build your own PowerShell modules to kill tickets & tabs using the PowerShell command Invoke-RestMethod.

  • 12
  • 6
  • 4
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now