天道酬勤,学无止境

pdf

如何在 Python 中解锁“安全”(读保护)PDF?(How to unlock a “secured” (read-protected) PDF in Python?)

问题 在 Python 中,我使用 pdfminer 从带有此消息下方代码的 pdf 中读取文本。 我现在收到一条错误消息: File "/usr/local/lib/python2.7/dist-packages/pdfminer/pdfpage.py", line 124, in get_pages raise PDFTextExtractionNotAllowed('Text extraction is not allowed: %r' % fp) PDFTextExtractionNotAllowed: Text extraction is not allowed: <cStringIO.StringO object at 0x7f79137a1 ab0> 当我用 Acrobat Pro 打开这个 pdf 时,它被证明是安全的(或“读保护”)。 但是,从此链接中,我了解到有许多服务可以轻松禁用此读取保护(例如 pdfunlock.com。在深入研究 pdfminer 的源代码时,我看到在这些行上生成了上述错误。 if check_extractable and not doc.is_extractable: raise PDFTextExtractionNotAllowed('Text extraction is not allowed: %r' % fp)

2021-06-21 12:32:21    分类:技术分享    python   pdf   pdfminer   pdf-scraping

Does android have a built-in PDF viewer?

I heard something recently about it being included in Froyo and I was wondering if there was any truth to it. If there is, it would help me with an app idea greatly.

2021-06-21 12:01:14    分类:问答    android   pdf   android-2.2-froyo   built-in

Remove verso and list of tables from DocBook document

I have problem with customization layer of DocBook XSL. I use Apache FOP to transform document from DocBook XML to PDF. But the book contains second page (so called verso) and page List of Tables. I just have erased the content of verso, but second page remains empty now. I don't now how to remove second empty page. (I have found one solution only. It is easy - just add <xsl:template name="book.titlepage.verso"/> to your templates, but after this element has been added, second page remains as empty page.) I'm likewise unable to find any solution how to remove page List of Tables.

2021-06-21 11:59:16    分类:问答    pdf   customization   apache-fop   docbook

UIGraphicsBeginPDFPage() randomly crashes on 64bit devices (CGPDFSecurityManagerCreateDecryptor ())

I'm struggling with a pdf export method that's was running just fine until I ported the app to the arm64 achitecture. Bacisally, the method opens an existing PDF, it creates a new pdf file, and draws the content of the first pdf into the newly created one before adding more content pages. When the method tries to create a new pdf page to the document (after the first pdf was integrated to the new pdf) the app crashes with a EXC_BAD_ACCESS warning on UIGraphicsBeginPDFPage(); call . It only happens with some PDF files, not all and only on 64 bit devices. Here's the stacktrace which shows the

2021-06-21 11:43:27    分类:问答    ios   pdf   uikit   quartz-2d   cgpdf

jsPDF with Cordova - Adding images

I am trying to generate a PDF using the jsPDF library (https://github.com/MrRio/jsPDF) from within a mobile Cordova app. I am currently testing the app on an Android 4.0.4 device but it also needs to run on Windows mobile 8. The text in the PDF document is shown correctly however any images are scrambled. See image below I did find this page (https://coderwall.com/p/nc8hia) that seemed to indicate there is a problem with jsPDF displaying images in Cordova (see comments) but the author never posted the follow-up. Has anyone been able to use jsPDF with Cordova and properly add images to the

2021-06-21 10:57:58    分类:问答    android   image   pdf   cordova   jspdf

下载时为空白 PDF(Blank PDF while downloading)

问题 我面临一个非常奇怪的问题,我正在尝试使用以下代码从我的 struts 应用程序发送 PDF 文件作为附件, JasperReport jrReport = (JasperReport) JRLoader.loadObject(jasperReport); JasperPrint jasperPrint = JasperFillManager.fillReport(jrReport, parameters, dataSource); jasperPrint.setName(fileNameTobeGivenToExportedReport); response.reset(); response.setContentType("application/pdf"); response.setHeader("Content-Disposition", "attachment; filename=\"" + fileNameTobeGivenToExportedReport + ".pdf" + "\""); response.setHeader("Cache-Control", "private"); JasperExportManager.exportReportToPdfStream(jasperPrint, response.getOutputStream())

2021-06-21 10:53:34    分类:技术分享    java   servlets   pdf   jasper-reports   struts

无法从 PDFA1-a 格式文档中提取图像(Not able to extract images from PDFA1-a format document)

问题 我正在使用以下代码从 PDFA1-a 格式的 pdf 中提取图像,但我无法获取图像。 List<PDPage> list = document.getDocumentCatalog().getAllPages(); String fileName = oldFile.getName().replace(".pdf", "_cover"); int totalImages = 1; for (PDPage page : list) { PDResources pdResources = page.findResources(); Map pageImages = pdResources.getImages(); if (pageImages != null) { InputStream xmlInputStream = null; Iterator imageIter = pageImages.keySet().iterator(); while (imageIter.hasNext()) { String key = (String) imageIter.next(); PDXObjectImage pdxObjectImage = (PDXObjectImage) pageImages.get(key); System.out.println

2021-06-21 10:36:51    分类:技术分享    java   pdf   pdfbox

Itext PDF do not display correctly Myanmar Unicode Font

Itext 5 do not display correctly at generated pdf file for Myanmar Unicode fonts. Itext version : 5.5.13.1 Expectation Result : သီဟိုဠ်မှ ဉာဏ်ကြီးရှင်သည်အာယုဝဎ္ဍနဆေးညွှန်းစာကို ဇလွန်ဈေးဘေးဗာဒံပင်ထက် အဓိဋ္ဌာန်လျက် ဂဃနဏဖတ်ခဲ့သည်။ Actual Result : Google Drive Link for generated PDF. My test string is similar with "The quick brown fox jump over the lazy dog" in English. It contains most of Myanmar alphabets. Java program that I used to product above pdf String fileName = "sample.pdf"; ByteArrayOutputStream baos = new ByteArrayOutputStream(); try { Document doc = new Document(); PdfWriter writer =

2021-06-21 10:25:06    分类:问答    java   pdf   itext

如何使用 Dompdf 转换多个 html 文件?(how to convert multiple html files with Dompdf?)

问题 我在做什么: 我正在使用一个名为 Dompdf 的 PHP 库将我的 HTML 文件转换为 PDF。 我已成功将单个 HTML 文件转换为 PDF。 我正在尝试做的事情: 现在我有多个报告,我想将它们转换为 PDF 文件。 我在做什么: 我在这里有一个例子,我从数据库中获取一个表单,另一个直接从视图中获取。 代码: $result['patients'] = $this->reports_model->get_xray_reports($id); // getting form from database require_once "dompdf/dompdf_config.inc.php"; // include dompdf $dompdf = new DOMPDF(); $dompdf->set_paper("A4"); $html = $this->load->view('wilcare/form_set_page_15',"",true);// loading direct from view //this file is not converting $html = $this->load->view('wilcare/report1',$result,true);//loading from db $dompdf->load_html($html)

2021-06-21 09:52:41    分类:技术分享    php   codeigniter   pdf   dompdf

Is it possible to make a pdf with different page size in Qt?

If the size of the page is same, then no problem, but I need the page size should be the size of Image(which is variable), void DgJpgToPdf::convertToPdf( const QStringList& theImagePathList, const QString& theOutputFileName ) { QPrinter printer; printer.setOrientation(QPrinter::Portrait); printer.setOutputFormat( QPrinter::PdfFormat ); printer.setOutputFileName( theOutputFileName ); QPainter painter; painter.begin( &printer ); //printer.newPage(); foreach( QString fileName, theImagePathList ){ QImage imgObj( fileName ); printer.setPaperSize( QSizeF(imgObj.width(), imgObj.height()), QPrinter

2021-06-21 09:49:48    分类:问答    c++   qt   pdf