In Pb, can I convert a file into a PDF file by calling the PDF. ocx control? Urgent !!!

Source: Internet
Author: User
Tags ole sybase xsl acrobat distiller

     

    1.download and install gs705w32.exe

    You can also download and install ghostscript7.07, but pb9 does not support gs8.0 and later versions!

    2. For powerbuilder9.0

    Add in system environment variable path

    The default installation path of gs705w32.exe is C:/GS (which can be modified)

    For example, C:/GS/gs7.05/bin/

    3. Install a virtual printer

    Go directly to "Control Panel"> "printer and fax"> "Add Printer ",

    The default LPT1 can be used for any port. We do not use it for printing.

    The key is the driver selection. This driver comes with powerbuilder9.0, which is located in the installation folder of powerbuilder9.0,

    Select "Install from disk"> "Sybase/shared/PowerBuilder/drivers ",

    Select the Adobe vendor's INF file "adist5.inf" and read the following five drivers:

    "Acrobat Distiller ",

    "Acrobat Distiller CS ",

    "Acrobat Distiller CT ",

    "Acrobat Distiller J ",

    "Acrobat Distiller K"

    Select the first "Acrobat Distiller" (the other four can also be used, but I still don't know the difference). Next, click "Finish installation"

    You can also edit the. BAT file in Sybase/shared/PowerBuilder/drivers and write it:

    Rundll32.exe printui. dll, printuientry/If/F.// Adist5.inf/R "LPT1:"/B "Acrobat Distiller"/m

     

    "Acrobat Distiller"

    Run it to add a virtual printer!

     

    4. Write the following code:

    Int li_ret

    String ls_docname, ls_named

    Integer li_value

     

    Li_value = getfilesavename ("select Save file ",&

    + Ls_docname, ls_named, "pdf file ",&

    + "Pdf file (*. pdf), *. pdf ")

     

    If li_value <> 1 then return

     

     

    Dw_1.object.data={export.}.method = distill!

    // Select a virtual printer

    Dw_1.object.data1_1_printer = "Acrobat Distiller"

    Dw_1.object.data+{export.}.distill.custompostscript = "yes"

     

    Li_ret = dw_1.saveas (ls_docname, PDF !, True)

     

    If li_ret = 1 then

    MessageBox ('prompt info', 'saved as a PDF file! '+ &

    '~ R ~ N file: '+ ls_docname)

    Else

    MessageBox ('prompt info', 'failed to save as a PDF file! ')

    End if

     

      • Dawugui
      • Regular turtles
      • Level 1:

      Posted on: floor,-08-31 score: 30

      Data window PDF output

      (The result of a single defeat was obtained in Nanshan District, Shenzhen in January 14, 2004)

      The PDF (Portable Document Format) format is an electronic file format developed by adoble. This file format has nothing to do with the operating system platform. That is to say, PDF files are common in either Widnows, UNIX, or Apple's Mac OS Operating System. This feature makes it an ideal document format for electronic document distribution and digital information dissemination on the Internet. More and more books, product descriptions, company reports, online materials, and emails are using PDF files.

      Pb9.0 adds support for saving the data window as a PDF document, and provides two methods to save the data window or data as a report in pdf format. The default extraction method is distill, which can save all types of data window objects. The data window can also save the PDF format using an XSL format object (XSL-FO.

      1. distill Extraction Method

      The distill method is the default method for generating PDF files in a data window. In this way, you do not need to change the properties of the data window object, you can directly select the file/save rows as menu item in the data window object canvas. In the pop-up "Save as" dialog box, select the Save type as PDF to save. If you use the Save As () function in the script, set the Save type to PDF, or save the data window as a PDF file.

      For example:

      Int li_ret

      String ls_docname, ls_named

      Integer li_value

      Li_value = getfilesavename ("select Save file", + ls_docname, ls_named, "pdf file", + "pdf file (*. pdf), *. pdf ")

      If li_value <> 1 then return

      Li_ret = dw_1.saveas (ls_docname, PDF !, True)

      If li_ret = 1 then

      MessageBox ('prompt info', 'saved as a PDF file! '+ '~ R ~ N file: '+ ls_docname)

      Else

      MessageBox ('prompt info', 'failed to save as a PDF file! ')

      End if

      Shows the PDF file generated by the data window object:

      The distill method currently does not support data window objects of the OLE and richtext types.

      PB uses a postscript printing driver designed for converting to PDF output for extraction. to customize postscript settings when generating a PDF document, you can select different postscript printing drivers. The method is as follows:

      1. Data window drawing board

      1) Open a data window object

      2) Select the data export tab in the object property view of the data window, select PDF from the format to configure drop-down list, and select distill from the method drop-down list !, Select the distill postscript M postscript check box. As shown in:

      3) Select the print specifications tab and enter the specified printer name in the printer Name text box.

      4) Save the data window object, select the file/save rows as menu item, in the pop-up "Save as" dialog box, select the Save type as PDF, and enter the file name in the file name text box.

       

      2. Use the following method in the script:

      Int li_ret

      Dw_1.object.data={export.}.method = distill!

      Dw_1.object.data?#printer =// Prntsrvr/pr-6

      Dw_1.object.data+{export.}.distill.custompostscript = "yes"

      Li_ret = dw_1.saveas ("M. pdf", PDF !, True)

       

       

      2. Saving PDF documents using XSL-FO

      Based on the ability to save datawindow data in XML format, Pb can also save the data and representation of the data window by generating an XSL format object (XSL-FO) to PDF document.

      XSL-FO is the Extensible style sheet language (Extensible Stylesheet Language for Formatting Objects) for Formatting Objects. To generate a PDF document using a XSL-FO, you must modify the properties of the data window objects.

      1. Data window drawing board

      1) Open the data window object.

      2) Select the data export tab in the object property view of the data window, select PDF from the format to configure drop-down list, and select export fop from the method drop-down list !. If you want to send a PDF file to the printer at the same time, select the "distill print using into fop" check box. As shown in:

      3) Save the data window object, select the file/save rows as menu item, in the pop-up "Save as" dialog box, select the Save type as PDF, and enter the file name in the file name text box.

       

      2. Use the following method in the script:

      Int li_ret

      String ls_docname, ls_named

      Integer li_value

       

      Li_value = getfilesavename ("select Save file ",&

      + Ls_docname, ls_named, "pdf file ",&

      + "Pdf file (*. pdf), *. pdf ")

      If li_value <> 1 then return

      // Customize XSL-FO Mode

      Dw_1.modify ("export. pdf. method = effecfop! ")

      Dw_1.modify ("export. pdf. Export fop. Print = 'Yes '")

      Li_ret = dw_1.saveas (ls_docname, PDF !, True)

      If li_ret = 1 then

      MessageBox ('prompt info', 'saved as a PDF file! '+ &

      '~ R ~ N file: '+ ls_docname)

      Else

      MessageBox ('prompt info', 'failed to save as a PDF file! ')

      End if

       

      The XSL-FO method currently does not support Ole, richtext, graph, and composite data window objects.

    Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.