PrimoPDF API

Met PrimoPDF API hebt u op programmeursniveau toegang tot alle PrimoPDF-instellingen, zodat ontwikkelaars vanuit bijna alle applicaties naar pdf kunnen afdrukken. Door middel van een stil installatiebestand kunnen ontwikkelaars PrimoPDF probleemloos bundelen en herdistribueren binnen hun bestaande desktop- of server-based applicaties zonder dat er aparte installatie of handmatige invententie moet plaatsvinden.

Neem contact met ons op voor meer info

Functies

  • Volledige ondersteuning voor double-byte tekens en niet-TrueType lettertypen
  • Verbeterde ondersteuning voor Windows 98, ME, XP en Vista
  • Verbeterde PDF-uitvoer
  • Ontwikkelaars hebben volledige toegang op programmeursniveau

Voorbeeldscript Word-naar-PDF

Het volgende voorbeeld van een VBScript toont hoe een Microsoft® Word document naar PDF wordt geconverteerd.

' Get local path as varPath
arrayScr = Split(WScript.ScriptFullName, "\", -1, 1)
For i = 0 to UBound(arrayScr) - 1
    strPath = strPath & arrayScr(i) & "\"
Next

' Define File Variables
strFileToCreate = strPath & "doc.pdf"
strFileToConvert = strPath & "word.doc"

' Instantiate the PrimoPDF Object
Set APPrimo = CreateObject("PrimoAPI.Object")

' Licensing Information (ignored with evaluation version)
APPrimo.UserString = "xxxxxxxxxxx"
APPrimo.LicenseKey = "POAxxxxxxxxxxxxxxxxxxxx"

' Set the output file name and location
APPrimo.OutputFile = strFileToCreate

' Optional properties should be added here

' Logging
APPrimo.DebugLogging = False

' Update the PrimoAPI printer with new settings
rtnPrinter = APPrimo.CreatePrinter
If rtnPrinter = 0 Then

    ' Automate the application to print to the PrimoAPI printer
    Set WordObject = CreateObject("Word.Application")
    WordObject.DisplayAlerts = False
    Set NewDoc = WordObject.Documents.Open (strFileToConvert, False, 	 True)
    Set WordDialog = WordObject.Dialogs(97)
    WordDialog.Printer = "PrimoAPI"
    WordDialog.DoNotSetAsSysDefault = 1
    WordDialog.Execute
    NewDoc.PrintOut False
    NewDoc.Close False
    WordObject.Quit False
    Set WordObject = Nothing

    ' Return the status 
    pdfStatus = APPrimo.CheckStatus(30)
    Select Case pdfStatus
        Case 0
            msgbox "Success!", 0, "Conversion"
        Case -1
            msgbox "File to create not specified!", 16, "Error"
        Case -2
            msgbox "Timeout!", 16, "Error"
        Case -3
            msgbox "Old file found!", 16, "Error"
        Case Else
            msgbox "Unknown Error: " & pdfStatus, 16, "Error"
    End Select
    
Else
    MsgBox "Create/Update Printer Error: " & rtnPrinter, 16, "Error"
End If

' Clear PrimoAPI Object
Set APPrimo = Nothing

Voorbeeldscript Excel-naar-PDF

Het volgende voorbeeld van een VBScript toont hoe een Microsoft® Excel werkmap naar PDF wordt geconverteerd.

' Get local path as varPath
arrayScr = Split(WScript.ScriptFullName, "\", -1, 1)
For i = 0 to UBound(arrayScr) - 1
    strPath = strPath & arrayScr(i) & "\"
Next

' Define File Variables
strFileToCreate = strPath & "xls.pdf"
strFileToConvert = strPath & "excel.xls"

' Instantiate the PrimoPDF Object
Set APPrimo = CreateObject("PrimoAPI.Object")

' Licensing Information (ignored with evaluation version)
APPrimo.UserString = "xxxxxxxxxxx"
APPrimo.LicenseKey = "POAxxxxxxxxxxxxxxxxxxxx"

' Set the output file name and location
APPrimo.OutputFile = strFileToCreate

' Optional properties should be added here

' Logging
APPrimo.DebugLogging = False

' Update the PrimoAPI printer with new settings
rtnPrinter = APPrimo.CreatePrinter
If rtnPrinter = 0 Then

    ' Automate the application to print to the PrimoAPI printer
    Set XLObject = CreateObject("Excel.Application")
    XLObject.DisplayAlerts = False
    Set NewDoc = XLObject.Workbooks.Open (strFileToConvert, _
                 , True, , , , True, , , False, False, , False)
    NewDoc.Activate
    NewDoc.PrintOut 1, 999, 1, False, "PrimoAPI", False, False
    NewDoc.Close 0
    XLObject.Quit
    Set XLObject = Nothing

    ' Return the status 
    pdfStatus = APPrimo.CheckStatus(30)
    Select Case pdfStatus
        Case 0
            msgbox "Success!", 0, "Conversion"
        Case -1
            msgbox "File to create not specified!", 16, "Error"
        Case -2
            msgbox "Timeout!", 16, "Error"
        Case -3
            msgbox "Old file found!", 16, "Error"
        Case Else
            msgbox "Unknown Error: " & pdfStatus, 16, "Error"
    End Select
    
Else
    MsgBox "Create/Update Printer Error: " & rtnPrinter, 16, "Error"
End If

' Clear PrimoAPI Object
Set APPrimo = Nothing

Voorbeeld VBScript voor PowerPoint-naar-PDF

Het volgende voorbeeld van een VBScript toont hoe een Microsoft® PowerPoint-presentatie naar PDF wordt geconverteerd.

' Get local path as varPath
arrayScr = Split(WScript.ScriptFullName, "\", -1, 1)
For i = 0 to UBound(arrayScr) - 1
    strPath = strPath & arrayScr(i) & "\"
Next

' Define File Variables
strFileToCreate = strPath & "ppt.pdf"
strFileToConvert = strPath & "powerpoint.ppt"

' Instantiate the PrimoPDF Object
Set APPrimo = CreateObject("PrimoAPI.Object")

' Licensing Information (ignored with evaluation version)
APPrimo.UserString = "xxxxxxxxxxx"
APPrimo.LicenseKey = "POAxxxxxxxxxxxxxxxxxxxx"

' Set the output file name and location
APPrimo.OutputFile = strFileToCreate

' Optional properties should be added here

' Logging
APPrimo.DebugLogging = False

' Update the PrimoAPI printer with new settings
rtnPrinter = APPrimo.CreatePrinter
If rtnPrinter = 0 Then

    ' Automate the application to print to the PrimoAPI printer
    Set PPObject = CreateObject("PowerPoint.Application")
    Set NewDoc = PPObject.Presentations.Open (strFileToConvert,-1, 0, 0)
    Set myOptions = NewDoc.PrintOptions
    myOptions.ActivePrinter = "PrimoAPI"
    myOptions.PrintInBackground = 0
    NewDoc.PrintOut 1, 9999, "", 1, 0
    NewDoc.Saved = 1
    NewDoc.Close
    PPObject.Quit
    Set PPObject = Nothing

    ' Return the status 
    pdfStatus = APPrimo.CheckStatus(30)
    Select Case pdfStatus
        Case 0
            msgbox "Success!", 0, "Conversion"
        Case -1
            msgbox "File to create not specified!", 16, "Error"
        Case -2
            msgbox "Timeout!", 16, "Error"
        Case -3
            msgbox "Old file found!", 16, "Error"
        Case Else
            msgbox "Unknown Error: " & pdfStatus, 16, "Error"
    End Select
    
Else
    MsgBox "Create/Update Printer Error: " & rtnPrinter, 16, "Error"
End If

' Clear PrimoAPI Object
Set APPrimo = Nothing



Houd contact met Nitro

Blijf up-to-date met Primo en
PDF op onze populaire
PDF-blog.

  • RSS
  • E-mail
  • Twitter
  • LinkedIn

Toekomst met PrimoPDF

Help mee de toekomst van Primo te
vormen. Ideeën aandragen en
stemmen.

Meld u aan voor de nieuwsbrief

Ontvang de laatste nieuwtjes, tips, trucs en speciale aanbiedingen van Primo PDF.

Bladwijzers maken en delen