0

Add hooks to PDFium PostScript code

Add new PDFium encoding function fuzzers to build and add Chromium hooks
to set the postscript level. This is in preparation for adding postscript
printing, see https://codereview.chromium.org/2633573002/

BUG=None

Review-Url: https://codereview.chromium.org/2642493002
Cr-Commit-Position: refs/heads/master@{#444347}
This commit is contained in:
rbpotter
2017-01-18 06:04:12 -08:00
committed by Commit bot
parent 37af6af68b
commit f28a3dba43
6 changed files with 30 additions and 0 deletions

@ -123,6 +123,10 @@ void SetPDFEnsureTypefaceCharactersAccessible(
void SetPDFUseGDIPrinting(bool enable) {
PDFEngineExports::Get()->SetPDFUseGDIPrinting(enable);
}
void SetPDFPostscriptPrintingLevel(int postscript_level) {
PDFEngineExports::Get()->SetPDFPostscriptPrintingLevel(postscript_level);
}
#endif // defined(OS_WIN)
bool GetPDFDocInfo(const void* pdf_buffer,

@ -82,6 +82,8 @@ void SetPDFEnsureTypefaceCharactersAccessible(
PDFEnsureTypefaceCharactersAccessible func);
void SetPDFUseGDIPrinting(bool enable);
void SetPDFPostscriptPrintingLevel(int postscript_level);
#endif // defined(OS_WIN)
// |page_count| and |max_page_width| are optional and can be NULL.

@ -341,6 +341,8 @@ class PDFEngineExports {
PDFEnsureTypefaceCharactersAccessible func) = 0;
virtual void SetPDFUseGDIPrinting(bool enable) = 0;
virtual void SetPDFPostscriptPrintingLevel(int postscript_level) = 0;
#endif // defined(OS_WIN)
// See the definition of RenderPDFPageToBitmap in pdf.cc for details.

@ -35,6 +35,13 @@ fuzzer_test("pdf_cmap_fuzzer") {
]
}
fuzzer_test("pdf_codec_a85_fuzzer") {
sources = []
deps = [
"//third_party/pdfium/testing/libfuzzer:pdf_codec_a85_fuzzer",
]
}
fuzzer_test("pdf_codec_fax_fuzzer") {
sources = []
deps = [
@ -42,6 +49,13 @@ fuzzer_test("pdf_codec_fax_fuzzer") {
]
}
fuzzer_test("pdf_codec_rle_fuzzer") {
sources = []
deps = [
"//third_party/pdfium/testing/libfuzzer:pdf_codec_rle_fuzzer",
]
}
fuzzer_test("pdf_codec_icc_fuzzer") {
sources = []
deps = [

@ -4103,6 +4103,12 @@ void PDFiumEngineExports::SetPDFEnsureTypefaceCharactersAccessible(
void PDFiumEngineExports::SetPDFUseGDIPrinting(bool enable) {
FPDF_SetPrintTextWithGDI(enable);
}
void PDFiumEngineExports::SetPDFPostscriptPrintingLevel(
int postscript_level) {
FPDF_SetPrintPostscriptLevel(postscript_level);
}
#endif // defined(OS_WIN)
bool PDFiumEngineExports::RenderPDFPageToBitmap(

@ -775,6 +775,8 @@ class PDFiumEngineExports : public PDFEngineExports {
PDFEnsureTypefaceCharactersAccessible func) override;
void SetPDFUseGDIPrinting(bool enable) override;
void SetPDFPostscriptPrintingLevel(int postscript_level) override;
#endif // defined(OS_WIN)
bool RenderPDFPageToBitmap(const void* pdf_buffer,
int pdf_buffer_size,