Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(254)

Side by Side Diff: fpdfsdk/src/fpdfview.cpp

Issue 345123002: Add support to extract viewer preference (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Rebase and warning fix Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « fpdfsdk/include/fpdfview.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 PDFium Authors. All rights reserved. 1 // Copyright 2014 PDFium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
6 6
7 #include "../include/fsdk_define.h" 7 #include "../include/fsdk_define.h"
8 #include "../include/fpdfview.h" 8 #include "../include/fpdfview.h"
9 #include "../include/fsdk_rendercontext.h" 9 #include "../include/fsdk_rendercontext.h"
10 #include "../include/fpdf_progressive.h" 10 #include "../include/fpdf_progressive.h"
(...skipping 841 matching lines...) Expand 10 before | Expand all | Expand 10 after
852 } 852 }
853 853
854 DLLEXPORT FPDF_BOOL STDCALL FPDF_VIEWERREF_GetPrintScaling(FPDF_DOCUMENT documen t) 854 DLLEXPORT FPDF_BOOL STDCALL FPDF_VIEWERREF_GetPrintScaling(FPDF_DOCUMENT documen t)
855 { 855 {
856 CPDF_Document* pDoc = (CPDF_Document*)document; 856 CPDF_Document* pDoc = (CPDF_Document*)document;
857 if (!pDoc) return TRUE; 857 if (!pDoc) return TRUE;
858 CPDF_ViewerPreferences viewRef(pDoc); 858 CPDF_ViewerPreferences viewRef(pDoc);
859 return viewRef.PrintScaling(); 859 return viewRef.PrintScaling();
860 } 860 }
861 861
862 DLLEXPORT int STDCALL FPDF_VIEWERREF_GetNumCopies(FPDF_DOCUMENT document)
863 {
864 CPDF_Document* pDoc = (CPDF_Document*)document;
865 if (!pDoc) return 1;
866 CPDF_ViewerPreferences viewRef(pDoc);
867 return viewRef.NumCopies();
868 }
869
870 DLLEXPORT FPDF_PAGERANGE STDCALL FPDF_VIEWERREF_GetPrintPageRange(FPDF_DOCUMENT document)
871 {
872 CPDF_Document* pDoc = (CPDF_Document*)document;
873 if (!pDoc) return NULL;
874 CPDF_ViewerPreferences viewRef(pDoc);
875 return viewRef.PrintPageRange();
876 }
877
878 DLLEXPORT FPDF_DUPLEXTYPE STDCALL FPDF_VIEWERREF_GetDuplex(FPDF_DOCUMENT documen t)
879 {
880 CPDF_Document* pDoc = (CPDF_Document*)document;
881 if (!pDoc) return DuplexUndefined;
882 CPDF_ViewerPreferences viewRef(pDoc);
883 CFX_ByteString duplex = viewRef.Duplex();
884 if (FX_BSTRC("Simplex") == duplex)
885 return Simplex;
886 if (FX_BSTRC("DuplexFlipShortEdge") == duplex)
887 return DuplexFlipShortEdge;
888 if (FX_BSTRC("DuplexFlipLongEdge") == duplex)
889 return DuplexFlipLongEdge;
890 return DuplexUndefined;
891 }
892
862 DLLEXPORT FPDF_DEST STDCALL FPDF_GetNamedDestByName(FPDF_DOCUMENT document,FPDF_ BYTESTRING name) 893 DLLEXPORT FPDF_DEST STDCALL FPDF_GetNamedDestByName(FPDF_DOCUMENT document,FPDF_ BYTESTRING name)
863 { 894 {
864 if (document == NULL) 895 if (document == NULL)
865 return NULL; 896 return NULL;
866 if (name == NULL || name[0] == 0) 897 if (name == NULL || name[0] == 0)
867 return NULL; 898 return NULL;
868 899
869 CPDF_Document* pDoc = (CPDF_Document*)document; 900 CPDF_Document* pDoc = (CPDF_Document*)document;
870 CPDF_NameTree name_tree(pDoc, FX_BSTRC("Dests")); 901 CPDF_NameTree name_tree(pDoc, FX_BSTRC("Dests"));
871 return name_tree.LookupNamedDest(pDoc, name); 902 return name_tree.LookupNamedDest(pDoc, name);
872 } 903 }
OLDNEW
« no previous file with comments | « fpdfsdk/include/fpdfview.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698