Questions tagged [pdf]

Portable Document Format (PDF) is an open standard for electronic document exchange maintained by the International Organization for Standardization (ISO). Questions can be about creating, reading, editing PDFs using different languages.

Filter by
Sorted by
Tagged with
6 votes
2 answers
682 views

Speed up search function for PDFs

This function takes a file path to a PDF file, and a search string(s). It spits out a count of the number of times the string(s) shows in the PDF. Any ideas how I can make it faster? It can be tested ...
Cam's user avatar
  • 235
1 vote
1 answer
60 views

Re-write of PDF invoices from user input, decoupling of Invoice from FPDF class

Following on from this post and taking on board some of the suggestions, what follows is a re-write of the original python code. It's also just a rewrite of some of the functionality, this code only ...
Lozminda's user avatar
  • 101
1 vote
2 answers
163 views

PDF invoices from user input

Firstly the goal of this code is a little more complex than in this post and the other invoice questions are C# Is there anything that just pops out as immeadiately unpythonic/wrong ? I have a few ...
Lozminda's user avatar
  • 101
0 votes
0 answers
78 views

Walk a folder of files and extract creation date, countries mentioned and a summary based on their text for each

I made a script that scans a folder of 723 documents (pdf, pptx, docx) to extract the 'Name', 'Type', 'NbPages', 'Creation Date', 'Period Date', 'Countries', 'Summary', 'Indicateurs', 'Path'. I think ...
Revolucion for Monica's user avatar
4 votes
2 answers
177 views

Unstructured to Structured TOC

The following code tries to convert an unstructured TOC with bounding box layout data given by the output of pdftotext -bbox-layout -f 11 -l 13 new_book.pdf toc.html...
Sati's user avatar
  • 417
7 votes
3 answers
756 views

Brute force search for pdf password in python

I forgot the password to my pdf. I remembered a few characters, so I made a simple password-cracker program in Python. Is the document lost now given the number of combinations? Out of curiosity, how ...
gabriel's user avatar
  • 71
3 votes
1 answer
66 views

PDFcomp: A PDF comprimer easy script

I developed this script in dead time to be able to compress the PDFs that they send me to university and also to be able to send scans to the various institutions that require formats that do not ...
NFVblog's user avatar
  • 61
4 votes
2 answers
308 views

Attempting an OOP approach for PDF Paranoia - Automate the Boring Stuff CH 15

This exercise is called PDF Paranoia and it comes from CH 15 of the book Automate the Boring Stuff With Python - second edition. There are two parts to the exercise, which I've separated into two ...
Ramza's user avatar
  • 171
3 votes
1 answer
2k views

Adding a PDF file using iText7

Can I improve this code and make it more beautiful? For example, I am using a switch statement and for each page but I only add edits to page 1 and page 2? ...
Jefferson's user avatar
  • 123
3 votes
1 answer
381 views

Resume Builder using Jinja Templates and HTML

I have attempted to hack together a CV/Resume builder and I would like a review. The aim is to output a styled PDF containing dynamic fields. I have taken a simple HTML file, an arguably bloated CSS ...
Bob's user avatar
  • 149
0 votes
1 answer
185 views

How to optimize the code of my pdf generation from DGV code using iText5 & c#?

I have 2 DGV's one containing bills info & another containing credit notes info. When at least one item from both the DGV's are selected then it should generate a pdf (result1) taking data from ...
Tamal Banerjee's user avatar
4 votes
1 answer
128 views

Shell script to download Project Euler problems and combine to PDF

This is a script I created that downloads Project Euler webpages and combines them to PDF. The script also downloads animated files. ...
qwr's user avatar
  • 1,055
3 votes
1 answer
223 views

Using fluent builder pattern for generating pdf

I'm testing to use a fluent builder pattern for generating a pdf file using AbcPDF. I've looked at several methods of accomplishing this and I'd be very glad to get some input on what I've written so ...
user1784297's user avatar
4 votes
1 answer
285 views

Copy data from a pdf into word for the purpose of starting a report

In order to write some reports I have to manually copy the name of client, address, claim number, etc from a pdf that I receive. I want to automate this part of the report writing by using vba to copy ...
joniponi's user avatar
7 votes
1 answer
2k views

Speeding up Python program that converts DOCX to PDF in Windows

This is meant to be a performance-centric question as this type of conversion is obviously very common. I'm wondering about the possibilities for making this process faster. I have a program that ...
rabbittas2739's user avatar
2 votes
2 answers
314 views

Secure file upload for PDF only

I am trying to create a secure file upload using PHP 7+ where I only allow PDF files. I found a lot of posts on this topic on different websites but couldn't find a complete solution that ensures that ...
keewee279's user avatar
  • 223
7 votes
2 answers
293 views

PDF merging program

I made a program that merges all the PDFs in a certain map. The program is made so it merges only one sided PDFs. I would like your opinion on the code and how can it be improved. ...
Murg's user avatar
  • 279
2 votes
1 answer
1k views

Creating a thumbnail of a PDF using Cairo, Poppler and Rust

I want to create thumbnails from PDF files – specifically, a thumbnail of the first page. Currently I use pdftocairo on the command line: ...
alexwlchan's user avatar
  • 8,545
5 votes
2 answers
2k views

PDF page & word count, recursive searching of directory tree, output to excel

I wrote this program as part of a work-related problem but with a focus on improving my Python skills. The program was needed to do a word count PDF files. The problem was there were a large number of ...
Cam's user avatar
  • 235
6 votes
2 answers
1k views

Class to generate a pdf invoice

I am learning to work with OOP design patterns and so I challenged myself with the idea of creating a way to generate a pdf invoice based on some information entered. So, this is what I have done so ...
Anastacia's user avatar
1 vote
0 answers
3k views

Python3 - Cropping PDF files according to coordinates

I have a python script, that is performing OCR on PDF pages. I am trying to do so I can provide coordinates to the script - so it will only select the text within the provided coordinates ...
oliverbj's user avatar
  • 257
4 votes
2 answers
9k views

Python3 - Determing if a PDF is scanned or "searchable"

I am in a situation where I need to determine if a PDF file is either: Scanned Searchable (contain text) To do this, I am simply running the command pdffonts on ...
oliverbj's user avatar
  • 257
11 votes
1 answer
2k views

Python script to extract text from PDF with images

I have the following Python script. The purpose of the script is to extract text from PDFs. I use textract for that because soon I realized there is no easy way to check if a page contains an image or ...
Iakovos Belonias's user avatar
6 votes
1 answer
478 views

Spliting PDF and get thumbnail while adding it to a ListView

I'm doing a application to work with PDF and TIFF files. To divide them, the user opens the file or folder (if it is a folder, it gets all the files inside) and the app splits the file, getting a tiny ...
Sofia Rodrigues's user avatar
4 votes
0 answers
108 views

Download and analyze PDFs of Congressional records

This is built with Python 2.7.15. The goal of this script is to count the number of words spoken by each Senator on the floor of Congress between given dates. It pulls from the Congressional Record, ...
Sebastian's user avatar
  • 141
11 votes
1 answer
411 views

Writing PDF files in C#

I have been making C# software to write PDF files. It's intended to be simple to use, compact, efficient and also reasonably simple to understand, maintain and extend as required. The basic ...
George Barwood's user avatar
7 votes
3 answers
369 views

Improved RFC 1951 Deflate compression

I have substantially revised my earlier implementation, it now seems to be competitive with the standard C# ZLib implementation, increasing compression while being faster for moderate length inputs, ...
George Barwood's user avatar
6 votes
2 answers
3k views

A Python script to plot data and save to PDF

I have a very simple Python script. All it does is open two data files from a given directory, read the data, make a series of plots and save as PDF. It works, but it is very slow. It takes almost 20 ...
point618's user avatar
  • 113
7 votes
1 answer
2k views

Open encrypted PDF file by trying passwords from a word list

As an exercise, I wrote a program to decrypt a PDF file. The only thing that is known about the encryption password is that it is a single English word (all capital or lowercase). The program uses a ...
Sandro4912's user avatar
  • 3,066
4 votes
1 answer
3k views

Decrypting PDF-Files

In Encrypt PDF-Files I provided a Python program to encrypt PDF-Files in a folder. This program here does the oposite. Giving a password and path all PDFs which are encrypted are decrypted in the ...
Sandro4912's user avatar
  • 3,066
9 votes
2 answers
1k views

Encrypt PDF-Files

I wrote the following program for encrypting PDF Files for checking out the PyPDF2 module. It takes a path and a password via the command line or user input. Then all PDF files in the provided folder ...
Sandro4912's user avatar
  • 3,066
5 votes
0 answers
56 views

CMYK shadings implementation for PGF

PGF is a graphics framework for \$\TeX\$ and friends. It supports shadings (gradients), but only in RGB. There is often a need to output shadings in CMYK and I am having a go at implementing this. I'...
David Purton's user avatar
1 vote
1 answer
72 views

Text extraction of document files

I have this script that pulls text out of .docx, .doc and .pdf files and uploads that text to an Azure SQL Server. This is so users can search on the contents of those documents without using Windows ...
Owain Esau's user avatar
7 votes
1 answer
113 views

Two versions of PDF-Selector

I have basically ended up with 2 versions of a PDF-Selector. Both versions do the same thing. I'm not sure which solution is better. Maybe someone could give me a code review. I use: PDFSharp-Nuget-...
Physics131's user avatar
0 votes
2 answers
727 views

VB.NET - Error Handling in Generic Class for PDF Merge

As a part of a project I'm working on, a new requirement has arisen for me to be able to generate multiple PDF files and then merge them together before they are delivered to our client(s). For this, ...
G_Hosa_Phat's user avatar
3 votes
1 answer
722 views

Retrieve TOC from PDF

I am reading 'Python Trick' in PDF type. To have a big picture of the book, I aim to get a structure dict of TOC from the book. So I copied its TOC from PDF to typora(a markdown editor) and solve the ...
Wizard's user avatar
  • 449
2 votes
2 answers
684 views

Extract images from a PDF or ZIP file

Input inputBlob - A PDF or ZIP file containing all the pages of many students' test papers. extension - The file type ("pdf" or ...
James's user avatar
  • 450
2 votes
1 answer
551 views

Bash - script to encrypt pdf files using pdfencrypt

I wrote a small script to get around the issue when using pdfencrypt on the command line the password is always echoed as well as being saved to the 'history'. <...
nath's user avatar
  • 321
1 vote
2 answers
141 views

Exporting Matlab Figures as PDF with a Minimal Amount of Whitespace for use in LaTeX

About this code This Matlab function takes in the handle of a figure and exports a PDF containing a vector image of the plot. The caller of this function can opt to even remove the axes if he or ...
jrh's user avatar
  • 412
5 votes
1 answer
919 views

Small program to download wikipedia articles to pdf

I made a small app to download wikipedia articles (and optionally those that it links to) as PDFs to take on the go. I'd eventually like to do a text-to-speech option and save the article as an mp3, ...
Matt's user avatar
  • 339
2 votes
1 answer
334 views

Batch convert images to PDF

I wrote a simple program that converts graphic files in a folder to a single PDF using Magic.NET. It works fine. I'm interested in general comments about the code ...
menteith's user avatar
  • 311
6 votes
1 answer
286 views

Makefile for building classwork from markdown files and LaTeX

The following makefile builds my classwork for my various college classes and builds pdfs to hold the notes I took during class. I would like feedback on my directory structure and any optimizations ...
HSchmale's user avatar
  • 895
3 votes
2 answers
466 views

Changing PDF annotation with JavaScript code to jump to page into regular to Go To Page action

I have just written my first program in C#. Please explain: Have I used any bad practices? How could the code be improved? I would appreciate if provide the ...
menteith's user avatar
  • 311
5 votes
2 answers
1k views

Classifying image by file extension within a PDF creator

To create a pdfDocument I am using following code which works as expected but do not want to use multiple if else. Any patterns or any design strategies? It may ...
Simsons's user avatar
  • 723
6 votes
2 answers
802 views

Implementing a PDF generator that converts classes into PDFs

I'm building a tool that takes in web requests and deserializes JSON requests into a C# class. Each page calls a different controller URL that is looking for a specific request. Once the request is ...
JD Davis's user avatar
  • 163
6 votes
1 answer
252 views

Get bibtex entries from metadata of PDF files

When I have to write a report or an article, I usually have my bibliography as PDFs in a specific folder, so I wrote this script to automate the generation of bibtex entries. It works so far, but I'd ...
nicoco's user avatar
  • 389
2 votes
0 answers
1k views

Using iTextSharp and AddDocument/FreeReader to create a PDF document in streaming fashion

I have a directory of PDF files I want to merge into a single PDF. The number of files in the directory could be 10s, 100s, or even 1000s, so I'm trying to make sure my process is streaming as much ...
Terry's user avatar
  • 229
2 votes
0 answers
2k views

Download a PDF and submit it as a print job

I have following Java code, which is to print PDF, but in a busy location this code is taking about 20 to 30 second delay before submitting to the hardware. get the PDF file via the network download ...
YumYumYum's user avatar
  • 141
1 vote
1 answer
75 views

PDF merging implementation

How can this be improved? ...
new coder's user avatar
5 votes
1 answer
280 views

MySQL/CUPS PDF printer for STAR TSP100 ECO

This is my very first attempt at Python and whilst the script works perfectly, I'd like to see if I'm missing anything obvious or doing anything particularly stupid. I think this runs on Python 2.7, ...
NicholasC's user avatar