Solved

gen_PDF

Posted on 2009-05-06
23
1,386 Views
Last Modified: 2013-12-20
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
Comment
Question by:sam15
  • 12
  • 6
  • 4
  • +1
23 Comments
 
LVL 14

Assisted Solution

by:sandeep_patel
sandeep_patel earned 100 total points
ID: 24320872
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
 

Author Comment

by:sam15
ID: 24321231
I attached the code for button. So powerbuilder 10.5 does not have any way to generate PDF or postscript files?
invoice.txt
0
 
LVL 18

Accepted Solution

by:
diasroshan earned 200 total points
ID: 24323784
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
 
LVL 4

Expert Comment

by:Lordain
ID: 24326509
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
 

Author Comment

by:sam15
ID: 24327505
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
 
LVL 4

Assisted Solution

by:Lordain
Lordain earned 200 total points
ID: 24327672
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
 

Author Comment

by:sam15
ID: 24327866
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
 
LVL 4

Expert Comment

by:Lordain
ID: 24329562
I believe the difference is one (saveas) is better for windows and the other for Java.
0
 

Author Comment

by:sam15
ID: 24329943
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
 

Author Comment

by:sam15
ID: 24330465
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
 
LVL 14

Expert Comment

by:sandeep_patel
ID: 24331324
0
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 

Author Comment

by:sam15
ID: 24332013
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
 
LVL 4

Expert Comment

by:Lordain
ID: 24332183
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
 

Author Comment

by:sam15
ID: 24332748
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
 
LVL 4

Expert Comment

by:Lordain
ID: 24332848
Yes
0
 
LVL 14

Expert Comment

by:sandeep_patel
ID: 24335405
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
 

Author Comment

by:sam15
ID: 24337622
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
 

Author Comment

by:sam15
ID: 24338302
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
 
LVL 14

Expert Comment

by:sandeep_patel
ID: 24338546
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
 
LVL 4

Expert Comment

by:Lordain
ID: 24338761
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
 

Author Comment

by:sam15
ID: 24339562
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
 

Author Comment

by:sam15
ID: 24344047
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
 

Author Comment

by:sam15
ID: 24355936
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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

This article was inspired by a question here at Experts Exchange (http://www.experts-exchange.com/Software/Photos_Graphics/Images_and_Photos/Q_28629170.html). The requirements stated in that question are (1) reduce the file size of a large number of…
PaperPort has a feature called the "Send To Bar". It provides a convenient, drag-and-drop interface for using other installed software, such as Microsoft Office. However, this article shows that the latest Office 2016 apps (installed with an Office …
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
In this sixth video of the Xpdf series, we discuss and demonstrate the PDFtoPNG utility, which converts a multi-page PDF file to separate color, grayscale, or monochrome PNG files, creating one PNG file for each page in the PDF. It does this via a c…

757 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now