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
12
votes
2answers
507 views

Application for converting markdown to PDF

First time writing C in a long time and would like some code review to try and improve my code. I have some specific questions, but first an introduction to the code. The application is a simple ...
11
votes
1answer
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 ...
11
votes
1answer
168 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 ...
10
votes
1answer
1k views

Read and replace URL from PDF file

This is a code I wrote to find all URL within a PDF file and replace the one that matches the ID that I passed as a parameter. It works as intended, but as I am a beginner on Java, I am sure there ...
9
votes
2answers
868 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 ...
8
votes
1answer
3k views

What can I improve on my iOS PDF class?

This is the first PDF class I have made for the iOS using code from Apple's samples. There could easily be stuff here wrong that I am missing. I intend this to get images out of for a layer, for ...
8
votes
1answer
218 views

LaTeX code for presentation slides

I'm giving a presentation in a few days. I'm preparing my material in LaTeX; however, I am relatively new to it. How can I make my LaTeX code more concise and less repetitive? Here is a reduced ...
7
votes
1answer
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 ...
6
votes
2answers
9k views

Ghost4J PDF to image conversion

The primary goal of this code is to convert a PDF file to images. I also create a directory under C:/Media based on a combination of the PDF name and current date ...
6
votes
2answers
424 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 ...
6
votes
1answer
630 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 ...
6
votes
1answer
104 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-...
6
votes
2answers
703 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 ...
6
votes
1answer
151 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 ...
6
votes
1answer
397 views

Dealing with a command line argument (path) with spaces

I created a key in Windows registry to have an option on every folder which allows me to simply right click, choose the right option and have a PDF made, either from JPGS, or PNGs, or TIFs. My ...
6
votes
1answer
195 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 ...
6
votes
1answer
213 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 ...
6
votes
3answers
177 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, ...
5
votes
2answers
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 ...
5
votes
3answers
572 views

PDF script tool to convert documents to PDF and add fields and scripts

This is an update from here. This tool is a Windows Form application that can add fields and scripts to PDF files, as well as convert Microsoft Office Word documents to PDF. The usage is as follows: ...
5
votes
3answers
7k views

Searching for a string in a downloaded PDF

This code goes to the website containing the PDF, downloads the PDF, then it converts this PDF to text. Finally, it reads this whole file (Over 5000 lines) into a list, line by line, and searches for ...
5
votes
1answer
110 views

ExcelVBA loop exports data from spreadsheet to table within Excel

I want to nest a for loop to cycle through the Range.Value but ("B4") throws me off and this can't be avoided. I was considering using an array to do this but can'...
5
votes
1answer
3k views

PDF processing by PDFBox app jar

I want to convert a large PDF file into individual text files with PDFBox using Python. This code takes lot of time to convert a PDF containing 1000 pages. Is there anything I can do to improve it? ...
5
votes
2answers
4k views

Finding matching PDF files in different folders and merging the two files into one

I have code which currently loops through one folder, finds two matching pdf-filenames and merges them into 1 pdf-file always in the same order. File 1 then File 2. My code is slow, maybe because ...
5
votes
1answer
289 views

PDF Script Tool - adds JavaScripts to PDF files

This is a Windows Forms application that adds JavaScripts to PDF files. It supports multiple files at the same time. Right now, the only supported script is a "time-stamp on print" script, but any ...
5
votes
1answer
210 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, ...
5
votes
0answers
48 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'...
4
votes
5answers
585 views

Class for generating PDF documents

Following is a chunk of code from my class which generates PDF documents. I am refactoring my code and in the process I have created short methods. But I have to pass 'table i.e PdfPTable' to my ...
4
votes
2answers
562 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 ...
4
votes
2answers
6k views

Searching through various PDF files

I'm just looking for advice on how I can get my code to operate faster. It's pretty quick right now with searching through 30 3-page PDFs, but I imagine once there gets to be thousands of files to ...
4
votes
2answers
3k views

Python code to encrypt and email PDF file using PyPDF2

This is my first programming project with real world application. It's purpose is to take a file from a directory, encrypt it with a predetermined password, and email to appropriate recipient. ID ...
4
votes
3answers
832 views

Converting Pandoc Markdown images from captioned to inline

After writing a rather long document in Markdown and using pandoc to convert it to a PDF, I found, to my dismay, that many of the images were out of place, and that they all had their alternate text ...
4
votes
2answers
4k views

Extract Pages from PDF based on search in python

Everything is working fine except timing. it takes lot time for my file containing 1000 pages and having 100 pages of interest. ...
4
votes
1answer
439 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, ...
4
votes
1answer
139 views

PDF conversion and time stamp tool

This is the latest edition of my PDF tool, previously mentioned here, here, here, and inspired by my first attempt at a MVP here. Major differences from previous editions: It uses the MVP pattern (...
4
votes
1answer
2k 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 ...
4
votes
1answer
793 views

pdftk replacement

I am working on a replacement for a program called pdftk. The program needs to be able to take pdf's, and generate fdf files for them, fill a pdf from an fdf, output info about the forms, and output ...
4
votes
1answer
1k views

Merging SharePoint Word documents into a single PDF with iTextSharp

I created a program which collects all the word files from a folder which belongs to our SharePoint library of documents. The program will only grab the documents if they were submitted/are a part of ...
4
votes
1answer
7k views

Removing a header and footer from text output with PDFminer

I use PDFminer to extract text from a PDF, then I reopen the output file to remove an 8 line header and 8 line footer. Is there a more efficient way to remove the header/footer, either in place or ...
4
votes
0answers
50 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, ...
3
votes
2answers
352 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 ...
3
votes
2answers
602 views

Stamp PDF file with name and company

I wrote some code to put stamps on all pages of a PDF file with the name and company passed as parameters. It works as intended, but as I am a beginner in Java, I am sure there are some best practices ...
3
votes
2answers
2k 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 ...
3
votes
2answers
175 views

Lots of Continues in an Inner Loop and Dictionary of Actions

I'm using ABCPDF (Version 8) to update an existing PDF document and I believe its API is hurting me in this situation and was curious whether anyone had any comments on how this looks as it appears ...
3
votes
1answer
274 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 ...
3
votes
1answer
157 views

Split big PDF into smaller documents and insert text at specific position

I’m new to Java programming and uncertain if I used the right approach to solve my job. This little program uses the iText library to split one big PDF into smaller documents. The trigger for this is ...
2
votes
2answers
616 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 ...
2
votes
2answers
2k views

Generating tables in a PDF document

I have this code to generate some tables in my PDF document for my Android app. It works fine, but I just think I need to refactor it as the same structure is repeated 3 times. ...
2
votes
2answers
101 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 ...
2
votes
1answer
237 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: ...