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:
pdf
@ -123,6 +123,10 @@ void SetPDFEnsureTypefaceCharactersAccessible(
|
|||||||
void SetPDFUseGDIPrinting(bool enable) {
|
void SetPDFUseGDIPrinting(bool enable) {
|
||||||
PDFEngineExports::Get()->SetPDFUseGDIPrinting(enable);
|
PDFEngineExports::Get()->SetPDFUseGDIPrinting(enable);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SetPDFPostscriptPrintingLevel(int postscript_level) {
|
||||||
|
PDFEngineExports::Get()->SetPDFPostscriptPrintingLevel(postscript_level);
|
||||||
|
}
|
||||||
#endif // defined(OS_WIN)
|
#endif // defined(OS_WIN)
|
||||||
|
|
||||||
bool GetPDFDocInfo(const void* pdf_buffer,
|
bool GetPDFDocInfo(const void* pdf_buffer,
|
||||||
|
@ -82,6 +82,8 @@ void SetPDFEnsureTypefaceCharactersAccessible(
|
|||||||
PDFEnsureTypefaceCharactersAccessible func);
|
PDFEnsureTypefaceCharactersAccessible func);
|
||||||
|
|
||||||
void SetPDFUseGDIPrinting(bool enable);
|
void SetPDFUseGDIPrinting(bool enable);
|
||||||
|
|
||||||
|
void SetPDFPostscriptPrintingLevel(int postscript_level);
|
||||||
#endif // defined(OS_WIN)
|
#endif // defined(OS_WIN)
|
||||||
|
|
||||||
// |page_count| and |max_page_width| are optional and can be NULL.
|
// |page_count| and |max_page_width| are optional and can be NULL.
|
||||||
|
@ -341,6 +341,8 @@ class PDFEngineExports {
|
|||||||
PDFEnsureTypefaceCharactersAccessible func) = 0;
|
PDFEnsureTypefaceCharactersAccessible func) = 0;
|
||||||
|
|
||||||
virtual void SetPDFUseGDIPrinting(bool enable) = 0;
|
virtual void SetPDFUseGDIPrinting(bool enable) = 0;
|
||||||
|
|
||||||
|
virtual void SetPDFPostscriptPrintingLevel(int postscript_level) = 0;
|
||||||
#endif // defined(OS_WIN)
|
#endif // defined(OS_WIN)
|
||||||
|
|
||||||
// See the definition of RenderPDFPageToBitmap in pdf.cc for details.
|
// 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") {
|
fuzzer_test("pdf_codec_fax_fuzzer") {
|
||||||
sources = []
|
sources = []
|
||||||
deps = [
|
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") {
|
fuzzer_test("pdf_codec_icc_fuzzer") {
|
||||||
sources = []
|
sources = []
|
||||||
deps = [
|
deps = [
|
||||||
|
@ -4103,6 +4103,12 @@ void PDFiumEngineExports::SetPDFEnsureTypefaceCharactersAccessible(
|
|||||||
void PDFiumEngineExports::SetPDFUseGDIPrinting(bool enable) {
|
void PDFiumEngineExports::SetPDFUseGDIPrinting(bool enable) {
|
||||||
FPDF_SetPrintTextWithGDI(enable);
|
FPDF_SetPrintTextWithGDI(enable);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void PDFiumEngineExports::SetPDFPostscriptPrintingLevel(
|
||||||
|
int postscript_level) {
|
||||||
|
FPDF_SetPrintPostscriptLevel(postscript_level);
|
||||||
|
}
|
||||||
|
|
||||||
#endif // defined(OS_WIN)
|
#endif // defined(OS_WIN)
|
||||||
|
|
||||||
bool PDFiumEngineExports::RenderPDFPageToBitmap(
|
bool PDFiumEngineExports::RenderPDFPageToBitmap(
|
||||||
|
@ -775,6 +775,8 @@ class PDFiumEngineExports : public PDFEngineExports {
|
|||||||
PDFEnsureTypefaceCharactersAccessible func) override;
|
PDFEnsureTypefaceCharactersAccessible func) override;
|
||||||
|
|
||||||
void SetPDFUseGDIPrinting(bool enable) override;
|
void SetPDFUseGDIPrinting(bool enable) override;
|
||||||
|
|
||||||
|
void SetPDFPostscriptPrintingLevel(int postscript_level) override;
|
||||||
#endif // defined(OS_WIN)
|
#endif // defined(OS_WIN)
|
||||||
bool RenderPDFPageToBitmap(const void* pdf_buffer,
|
bool RenderPDFPageToBitmap(const void* pdf_buffer,
|
||||||
int pdf_buffer_size,
|
int pdf_buffer_size,
|
||||||
|
Reference in New Issue
Block a user