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

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: Review feedback (return proper value) 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 848 matching lines...) Expand 10 before | Expand all | Expand 10 after
859 } 859 }
860 860
861 DLLEXPORT FPDF_BOOL STDCALL FPDF_VIEWERREF_GetPrintScaling(FPDF_DOCUMENT documen t) 861 DLLEXPORT FPDF_BOOL STDCALL FPDF_VIEWERREF_GetPrintScaling(FPDF_DOCUMENT documen t)
862 { 862 {
863 CPDF_Document* pDoc = (CPDF_Document*)document; 863 CPDF_Document* pDoc = (CPDF_Document*)document;
864 if (!pDoc) return TRUE; 864 if (!pDoc) return TRUE;
865 CPDF_ViewerPreferences viewRef(pDoc); 865 CPDF_ViewerPreferences viewRef(pDoc);
866 return viewRef.PrintScaling(); 866 return viewRef.PrintScaling();
867 } 867 }
868 868
869 DLLEXPORT int STDCALL FPDF_VIEWERREF_GetNumCopies(FPDF_DOCUMENT document)
870 {
871 CPDF_Document* pDoc = (CPDF_Document*)document;
872 if (!pDoc) return TRUE;
Vitaly Buka (NO REVIEWS) 2014/07/08 23:33:13 return 1
Nikhil 2014/07/09 06:19:05 Done.
873 CPDF_ViewerPreferences viewRef(pDoc);
874 return viewRef.NumCopies();
875 }
876
877 DLLEXPORT FPDF_PAGERANGE STDCALL FPDF_VIEWERREF_GetPrintPageRange(FPDF_DOCUMENT document)
878 {
879 CPDF_Document* pDoc = (CPDF_Document*)document;
880 if (!pDoc) return NULL;
881 CPDF_ViewerPreferences viewRef(pDoc);
882 return viewRef.PrintPageRange();
883 }
884
885 DLLEXPORT FPDF_DUPLEXTYPE STDCALL FPDF_VIEWERREF_GetDuplex(FPDF_DOCUMENT documen t)
886 {
887 CPDF_Document* pDoc = (CPDF_Document*)document;
888 if (!pDoc) return DuplexUndefined;
889 CPDF_ViewerPreferences viewRef(pDoc);
890 CFX_ByteString duplex = viewRef.Duplex();
891 if (FX_BSTRC("None") == duplex)
892 return DuplexUndefined;
893 if (FX_BSTRC("Simplex") == duplex)
894 return Simplex;
895 if (FX_BSTRC("DuplexFlipShortEdge") == duplex)
896 return DuplexFlipShortEdge;
897 if (FX_BSTRC("DuplexFlipLongEdge") == duplex)
898 return DuplexFlipLongEdge;
899 }
900
869 DLLEXPORT FPDF_DEST STDCALL FPDF_GetNamedDestByName(FPDF_DOCUMENT document,FPDF_ BYTESTRING name) 901 DLLEXPORT FPDF_DEST STDCALL FPDF_GetNamedDestByName(FPDF_DOCUMENT document,FPDF_ BYTESTRING name)
870 { 902 {
871 if (document == NULL) 903 if (document == NULL)
872 return NULL; 904 return NULL;
873 if (name == NULL || name[0] == 0) 905 if (name == NULL || name[0] == 0)
874 return NULL; 906 return NULL;
875 907
876 CPDF_Document* pDoc = (CPDF_Document*)document; 908 CPDF_Document* pDoc = (CPDF_Document*)document;
877 CPDF_NameTree name_tree(pDoc, FX_BSTRC("Dests")); 909 CPDF_NameTree name_tree(pDoc, FX_BSTRC("Dests"));
878 return name_tree.LookupNamedDest(pDoc, name); 910 return name_tree.LookupNamedDest(pDoc, name);
879 } 911 }
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