From 0e5bab1b8402b65fa09a36a2b141bbf22291f822 Mon Sep 17 00:00:00 2001 From: Tom Sepez Date: Thu, 18 Oct 2018 21:39:40 +0000 Subject: Remove PrintParams object. The only way to theoretically get one is via doc.getPrintParams(), and it always returns in error. Even if one were returend to JS, there aren't any methods/callbacks to change its properties. Even if there were methods to change its properties, the information it stores doesn't align with what is in the JS spec for this object. Even if it were aligned with the JS spec, the way we check for its presence as the ninth parameter in CJS_Document::print() doesn't match the way its use is documented in the spec as the sole first parameter. Instead implement the older, simpler behaviour as spec'd prior to 6.0, and toss this enhancement altogether. Move function to check the result of ExpandKeywordParams() to js_define.h so other files can use it. Update comment in that file to remove reference to deprecated enum. Expand test for API and introduce callback to log parameters. Change-Id: I047e2be0d2afbad91d6b58c6c74bbea083fed330 Reviewed-on: https://pdfium-review.googlesource.com/c/44271 Commit-Queue: Tom Sepez Reviewed-by: Lei Zhang --- samples/pdfium_test.cc | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'samples') diff --git a/samples/pdfium_test.cc b/samples/pdfium_test.cc index e64382c911..c5c298d23e 100644 --- a/samples/pdfium_test.cc +++ b/samples/pdfium_test.cc @@ -219,6 +219,19 @@ void ExampleDocMail(IPDF_JSPLATFORM*, GetPlatformWString(BCC).c_str(), GetPlatformWString(Subject).c_str(), GetPlatformWString(Msg).c_str()); } + +void ExampleDocPrint(IPDF_JSPLATFORM*, + FPDF_BOOL bUI, + int nStart, + int nEnd, + FPDF_BOOL bSilent, + FPDF_BOOL bShrinkToFit, + FPDF_BOOL bPrintAsImage, + FPDF_BOOL bReverse, + FPDF_BOOL bAnnotations) { + printf("Doc Print: %d, %d, %d, %d, %d, %d, %d, %d\n", bUI, nStart, nEnd, + bSilent, bShrinkToFit, bPrintAsImage, bReverse, bAnnotations); +} #endif // PDF_ENABLE_V8 void ExampleUnsupportedHandler(UNSUPPORT_INFO*, int type) { @@ -724,6 +737,7 @@ void RenderPdf(const std::string& name, platform_callbacks.app_beep = ExampleAppBeep; platform_callbacks.Doc_gotoPage = ExampleDocGotoPage; platform_callbacks.Doc_mail = ExampleDocMail; + platform_callbacks.Doc_print = ExampleDocPrint; #endif // PDF_ENABLE_V8 FPDF_FORMFILLINFO_PDFiumTest form_callbacks = {}; -- cgit v1.2.3