Jump to content

Recommended Posts

Posted

Dear forum, I used the following code to display a PDF file in a gui. Unfortunately the document always opens with margins. Does anyone have any idea why this might be? The side edges should go! Thank you in advance

#NoTrayIcon
#include <ButtonConstants.au3>
#include <Array.au3>
#include <File.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <GuiListView.au3>
#include <Date.au3>
#include <ComboConstants.au3>
#include <EditConstants.au3>
#include "GUITreeViewEx_Test.au3"
#include <Excel.au3>
#include "ArrayMultiColSort.au3"

    $Archivdatei = FileOpenDialog("Wähle .pdf-Datei!", @ScriptDir, "PDF (*.pdf)")
    $oPDF = ObjCreate("AcroPDF.PDF.1")
    If Not IsObj($oPDF) Then
    MsgBox(16, "Error", "Failed to create AcroPDF object")
    Exit
    EndIf
    $oPDF.src = $Archivdatei
    $oPDF.setShowToolbar(0)
    $oPDF.setShowScrollbars(0)
    $oPDF.setView('Fit')
    $oPDF.setLayoutMode('SinglePage')
    $oPDF.setPageMode('None')

    global $hMain1 = GUICreate('Test', 387, 608);,$iGui1X+$WidthGUI2);, BitOR($GUI_SS_DEFAULT_GUI, $WS_SIZEBOX, $WS_MAXIMIZEBOX, $WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS, $WS_CLIPCHILDREN))
    global $pdfCtrl= GUICtrlCreateObj($oPDF, 0, 0, 387-10, 608-10)

    GUISetState(@SW_SHOW, $hMain1)


    While 1
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            GUIDelete($hMain1)
            ExitLoop
    EndSwitch

    WEnd

 

bild.jpg

Posted

Just send a CTRL+H when the document is loaded or if you have the Acrobat Pro version you can use SetViewMode method of AcroExch.AVDoc (you might find some examples on the forum if you search).

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...