Print Page | Close Window

How to set the pdf-viewer-preferences

Printed From: Debenu Quick PDF Library - PDF SDK Community Forum
Category: For Users of the Library
Forum Name: Sample Code
Forum Description: Share Debenu Quick PDF Library sample code with other forum members
URL: http://www.quickpdf.org/forum/forum_posts.asp?TID=1415
Printed Date: 25 Nov 24 at 7:04PM
Software Version: Web Wiz Forums 11.01 - http://www.webwizforums.com


Topic: How to set the pdf-viewer-preferences
Posted By: Ingo
Subject: How to set the pdf-viewer-preferences
Date Posted: 16 Apr 10 at 9:16PM
Hi!

The following code is out of a complete app.
There is a window where you can make all settings...
So in the code checkbox-values are used.
But this doesn't matter to you - you shall see how to call
the functions ;-)

The code is in Delphi but this should be no prob
for a developer ;-)

Cheers, Ingo


   QP  := TQuickPDF718.Create;
   try
      Save_Cursor   := Screen.Cursor;
      Screen.Cursor := crHourglass;    // Show hourglass cursor
      QP.UnlockKey('...');
      QP.LoadFromFile(Edit1.text);
      
      If QP.EncryptionStatus > 0 Then
         QP.Decrypt;

//-------------------------------------------
      if cbhtb.Checked = True Then
         QP.SetViewerPreferences(1,1)  // Hide toolbar
        Else
         QP.SetViewerPreferences(1,0);
      if cbhmb.Checked = True Then
         QP.SetViewerPreferences(2,1)  // Hide menubar
        Else
         QP.SetViewerPreferences(2,0);
      if cbhwui.Checked = True Then
         QP.SetViewerPreferences(3,1)  // Hide windows user interface
        Else
         QP.SetViewerPreferences(3,0);
      if cbrwfps.Checked = True Then
         QP.SetViewerPreferences(4,1)  // Resize window to first page size
        Else
         QP.SetViewerPreferences(4,0);
      if cbcw.Checked = True Then
         QP.SetViewerPreferences(5,1)  // Center window
        Else
         QP.SetViewerPreferences(5,0);
      if cbddt.Checked = True Then
         QP.SetViewerPreferences(6,1)  // Display document title
        Else
         QP.SetViewerPreferences(6,0);

      if cbseite.Checked = False Then
      begin
         if cbfwindow.Checked = True Then
            QP.SetOpenActionDestination(1, -1) // -1 for Fit in window
           Else
            QP.SetOpenActionDestination(1, 100);
         if cbfwidth.Checked = True Then
            QP.SetOpenActionDestination(1, -2) // -2 for Fit in Width
           Else
            QP.SetOpenActionDestination(1, 100);
         if cbzoom.Checked = True Then
            QP.SetOpenActionDestination(1, 100);// Display first page with 100%
      end;
      if cbseite.Checked = True Then
      begin
         if cbfwindow.Checked = True Then
            QP.SetOpenActionDestination(SpinEdit1.Value, -1) // -1 for Fit in window
           Else
            QP.SetOpenActionDestination(SpinEdit1.Value, 100);
         if cbfwidth.Checked = True Then
            QP.SetOpenActionDestination(SpinEdit1.Value, -2) // -2 for Fit in Width
           Else
            QP.SetOpenActionDestination(SpinEdit1.Value, 100);
         if cbzoom.Checked = True Then
            QP.SetOpenActionDestination(SpinEdit1.Value, 100);// Display first page with 100%
      end;
      QP.SaveToFile(Edit1.Text);
//-------------------------------------------
   finally
      QP.Free;
      Screen.Cursor := Save_Cursor;
   end;

   ShowMessage('Complete...');
 



Replies:
Posted By: Shotgun Tom
Date Posted: 17 Apr 10 at 4:45PM
Nice one, Ingo... Thanks!
 
Tom


Posted By: mortendc
Date Posted: 30 Jun 15 at 3:08PM
Hi Ingo

Great, thanks a lot for helping out!

Kind regards 

Morten
 





Print Page | Close Window

Forum Software by Web Wiz Forums® version 11.01 - http://www.webwizforums.com
Copyright ©2001-2014 Web Wiz Ltd. - http://www.webwiz.co.uk