diff --git a/utils/pdftocairo.1 b/utils/pdftocairo.1 index a7bfb23..218e3ec 100644 --- a/utils/pdftocairo.1 +++ b/utils/pdftocairo.1 @@ -217,6 +217,9 @@ lower-left corner of the paper instead (PS,PDF,SVG only). Adds the %%IncludeFeature: *Duplex DuplexNoTumble DSC comment to the PostScript file (PS only). This tells the print manager to enable duplexing. .TP +.B \-noannotate +Don't display PDF annotations (such as PDF form fields). +.TP .BI \-printer " printer-name" (Windows only). When used with \-print, specifies the name of the printer to be used, instead of the system default. .TP diff --git a/utils/pdftocairo.cc b/utils/pdftocairo.cc index 47783e8..2589738 100644 --- a/utils/pdftocairo.cc +++ b/utils/pdftocairo.cc @@ -118,6 +118,7 @@ static GBool expand = gFalse; static GBool noShrink = gFalse; static GBool noCenter = gFalse; static GBool duplex = gFalse; +static GBool noAnnotate = gFalse; static char tiffCompressionStr[16] = ""; static char ownerPassword[33] = ""; @@ -244,6 +245,8 @@ static const ArgDesc argDesc[] = { "don't center pages smaller than the paper size"}, {"-duplex", argFlag, &duplex, 0, "enable duplex printing"}, + {"-noannotate", argFlag, &noAnnotate, 0, + "don't render annotations"}, {"-opw", argString, ownerPassword, sizeof(ownerPassword), "owner password (for encrypted files)"}, @@ -587,6 +590,12 @@ static void beginPage(double *w, double *h) } } +// Callback that decides if annotations should be drawn +static GBool annotDisplayDecideCbk(Annot *annot, void *userdata) +{ + return (noAnnotate) ? gFalse : gTrue; +} + static void renderPage(PDFDoc *doc, CairoOutputDev *cairoOut, int pg, double page_w, double page_h, double output_w, double output_h) @@ -624,7 +633,10 @@ static void renderPage(PDFDoc *doc, CairoOutputDev *cairoOut, int pg, !useCropBox, /* useMediaBox */ gFalse, /* Crop */ printing, - -1, -1, -1, -1); + -1, -1, -1, -1, + NULL, NULL, /* abortCheck callback and data */ + annotDisplayDecideCbk, NULL /* annotDisplayDecide callback and data */ + ); cairo_restore(cr); cairoOut->setCairo(NULL);