PDF Library für VO

Deutschsprachiges X#-Forum – German language forum

Moderator: wriedmann

User avatar
SHirsch
Posts: 284
Joined: Tue Jan 30, 2018 8:23 am
Location: Germany

PDF Library für VO

Post by SHirsch »

Hallo Joachim,

schau dir mal Pdfium an. Ist ne Weile her das ich damit mal experimentiert habe. Kann Anzeigen und Drucken (dafür hätten wir das benötigt). Allerdings ist das soweit ich mich erinnere C++ aber es gibt einige Wrapper in C#.

Stefan
g.bunzel@domonet.de
Posts: 97
Joined: Tue Mar 01, 2016 11:50 am
Location: Germany

PDF Library für VO

Post by g.bunzel@domonet.de »

Hallo Joachim,

die Anzeige einer Pdf-Datei in einem eigenen Fenster funktioniert mit Sumatra-PDF:

METHOD ShowPdf (cFile AS STRING) AS VOID PASCAL CLASS dlgPdfViewer
LOCAL cHwnd, cCmdLine AS STRING

IF File("SumatraPDF.exe") .AND. File(cFile)

cHwnd := NTrim( DWORD(_CAST, SELF:Handle()) )

// EXECUTE FILE 'SumatraPDF.exe' PARAMETERS ' -plugin ' + cHwnd + ' ' + cFile
// '-page ' + NTrim(nPage) + ' -lang ' + cLang + ' -plugin '....

cCmdLine := ' -plugin ' + cHwnd + ' "' + cFile + '"'

OpenObjectEx ( "SumatraPDF.exe", SELF:Handle(), FALSE, cCmdLine, NULL_STRING )

ENDIF

RETURN

Hier der Resize zur Anzeige:
METHOD Resize (oEvent) CLASS dlgPdfViewer
LOCAL oEvt AS ResizeEvent
LOCAL nHSumatraFrame AS PTR
LOCAL nWidth, nHight AS INT

oEvt := oEvent

SUPER:Resize (oEvt)

nHSumatraFrame := FindWindowEx(SELF:Handle(), 0, String2Psz("SUMATRA_PDF_FRAME"), NULL_PSZ)

IF nHSumatraFrame != NULL_PTR
nWidth := GetSystemMetrics(SM_CXVSCROLL)
nHight := GetSystemMetrics(SM_CYHSCROLL)

SetWindowPos(nHSumatraFrame, 0, 0, 0, SELF:size:width - nWidth, SELF:size:height - nHight, _OR(SWP_NOACTIVATE, SWP_NOZORDER, SWP_NOMOVE))

RedrawWindow(nHSumatraFrame, 0, 0, 0)
ENDIF

RETURN NIL


FUNCTION OpenObjectEx ( cFile AS STRING, hHandle AS PTR, lNoClose := FALSE AS LOGIC, cParameters AS STRING, cWorkDir AS STRING ) AS PTR PASCAL
LOCAL lpShellInfo IS _winShellExecuteInfo
LOCAL hProc AS PTR

lpShellInfo.cbSize := _SIZEOF( _winSHELLEXECUTEINFO )
lpShellInfo.hwnd := hHandle
IF lNoClose
lpShellInfo.fMask := SEE_MASK_NOCLOSEPROCESS
ENDIF
lpShellInfo.lpVerb := String2Psz("open")
lpShellInfo.lpFile := String2Psz(cFile)
lpShellInfo.lpParameters := String2Psz(cParameters )
lpShellInfo.lpDirectory := String2Psz(cWorkDir)
lpShellInfo.nShow := SW_ShowNormal // SW_ShowMaximized

IF ShellExecuteEx( @lpShellInfo )
hProc := lpShellInfo.hProcess
IF lNoClose
// Warten, bis das Object geschlossen wurde...
WHILE WaitForSingleObject( hProc, 0 ) == WAIT_TIMEOUT
Sleep(500)
ENDDO
hProc := NULL_PTR
ENDIF
ENDIF

RETURN hProc


HTH

Gerhard Bunzel
User avatar
Joachim Bieler
Posts: 36
Joined: Mon Aug 19, 2019 1:51 pm
Location: Germany

PDF Library für VO

Post by Joachim Bieler »

Thanks for the information about Syncfusion. If I understood the documentation correctly, it is provided for .NET and not for VO, C, etc. But this is a prerequisite.

Regards
Joachim
User avatar
Joachim Bieler
Posts: 36
Joined: Mon Aug 19, 2019 1:51 pm
Location: Germany

PDF Library für VO

Post by Joachim Bieler »

Hallo Stefan,

danke für die Info zu Pdfium. Ich werde mir das Tool einmal anschauen.

Gruß
Joachim
User avatar
Joachim Bieler
Posts: 36
Joined: Mon Aug 19, 2019 1:51 pm
Location: Germany

PDF Library für VO

Post by Joachim Bieler »

Hallo Gerhard,

jetzt bin ich aber baff! Das hätte ich von SumatraPDF nicht erwartet. Das scheint ein sehr flexibles Tool zu sein. Ich werde mir das Tool mal genauer anschauen. Vielen Dank auch für die Code-Beispiele. Diese helfen mir sehr gut.

Gruß
Joachim
Post Reply