X-Git-Url: http://git.asbjorn.it/?a=blobdiff_plain;f=lib%2Fpdf%2Fpdf.cc;h=9390e4a28b214ad8119632f734c8b4749d705047;hb=d0f9d82a8652cedc913671a2caf8d7a367beadb1;hp=285e01b69c2074a636f2404c9fab9a8a8a7fb0f6;hpb=a6575796e7d5e7a73c568b6f2a873be3c1d45dfd;p=swftools.git diff --git a/lib/pdf/pdf.cc b/lib/pdf/pdf.cc index 285e01b..9390e4a 100644 --- a/lib/pdf/pdf.cc +++ b/lib/pdf/pdf.cc @@ -34,6 +34,7 @@ typedef struct _pdf_page_info typedef struct _pdf_doc_internal { int protect; + int nocopy; PDFDoc*doc; Object docinfo; InfoOutputDev*info; @@ -78,7 +79,6 @@ void render2(gfxpage_t*page, gfxdevice_t*dev) pi->middev->setparameter(pi->middev, "protect", "1"); dev = pi->middev; } - dev->setparameter(dev, "protect", "1"); if(!pi) { msg(" pdf_page_render: Parent PDF this page belongs to doesn't exist yet/anymore"); @@ -188,6 +188,10 @@ gfxpage_t* pdf_doc_getpage(gfxdocument_t*doc, int page) if(page < 1 || page > doc->num_pages) return 0; + if(di->nocopy) { + msg(" PDF disallows copying."); + return 0; + } gfxpage_t* pdf_page = (gfxpage_t*)malloc(sizeof(gfxpage_t)); pdf_page_internal_t*pi= (pdf_page_internal_t*)malloc(sizeof(pdf_page_internal_t)); @@ -388,8 +392,7 @@ static gfxdocument_t*pdf_open(gfxsource_t*src, const char*filename) i->protect = 0; if (i->doc->isEncrypted()) { if(!i->doc->okToCopy()) { - printf("PDF disallows copying.\n"); - return 0; + i->nocopy = 1; } if(!i->doc->okToChange() || !i->doc->okToAddNotes()) i->protect = 1;