pdf

Download PDF file from api using javascript IE9

ぐ巨炮叔叔 提交于 2021-02-10 15:44:17
问题 I use angular 1.5 to get a PDF file from an API. Here is my code : $http.get('http://www.example.com/pdf.php') .then(function(response) { if (response) { // get pdf try { var isFileSaverSupported = !!new Blob; var blob = new Blob([response.data], {type: "application/pdf;charset=utf-8"}); FileSaver.saveAs(blob, "Test file.pdf"); } catch (e) { var w = window.open(); var doc = w.document; doc.open( 'application/pdf','replace'); doc.charset = "utf-8"; doc.write(response.data); doc.close(); doc

How to generate Dyanamic no of pages using PDFBOX

泪湿孤枕 提交于 2021-02-10 15:40:35
问题 I have to generate a pdf file depending on some input .Each time the code runs , the input length may vary , so how can I add pages to the document dynamically depending on my input content . public class pdfproject { static int lineno=768; public static void main (String[] args) throws Exception { PDDocument doc= new PDDocument(); PDPage page = new PDPage(); doc.addPage(page); PDPageContentStream cos = new PDPageContentStream(doc, page); for(int i=0;i<2000;i++) { renderText("hello"+i,cos,60)

corrupted UTF characters in pdf plots generated by R

女生的网名这么多〃 提交于 2021-02-10 14:48:52
问题 I am trying to save plots with legends containing UTF characters for Males and Females to pdf in R . When I plot to graphics device : plot(1) legend('topright', bty = 'n', expression(italic("legend"~"\u2640"~"\u2642"))) the legend of plot looks as expected I can even save it to pdf by right click and "save to pdf". However, when I use inbuilt function pdf pdf('test.pdf') plot(1) legend('topright', bty = 'n', expression(italic("legend"~"\u2640"~"\u2642"))) dev.off() it drops a warning and

Extracting images from pdf using Python

无人久伴 提交于 2021-02-10 14:33:50
问题 How can we extract images(only images) from PDF. I used many online tools, they all are not universal. In most of the PDF, it tools the screenshot of the whole image instead of the image. PDF link -> sg.inflibnet.ac.in:8080/jspui/bitstream/10603/121661/9/09_chapter 4.pdf 回答1: Here is some code that reads a PDF-File using pyPdf, extracts images and yields them as a PIL.Image . You need to modify it to your needs, it's just here to demonstrate how to walk the object tree. import io import pyPdf

Extracting images from pdf using Python

核能气质少年 提交于 2021-02-10 14:31:45
问题 How can we extract images(only images) from PDF. I used many online tools, they all are not universal. In most of the PDF, it tools the screenshot of the whole image instead of the image. PDF link -> sg.inflibnet.ac.in:8080/jspui/bitstream/10603/121661/9/09_chapter 4.pdf 回答1: Here is some code that reads a PDF-File using pyPdf, extracts images and yields them as a PIL.Image . You need to modify it to your needs, it's just here to demonstrate how to walk the object tree. import io import pyPdf

Add Duplex option for certain pages in postscript file using ghostscript

不羁岁月 提交于 2021-02-10 13:00:07
问题 I have a pdf file with 3 pages. I want to print first page as simplex and second & third page as duplex(double-sided - second on the front, third on the back). How can I generate the required postscript with ghostscript. I found the below solution on the internet and it works, but it makes the whole document as duplex. gswin64c.exe -q -dSAFER -dNOPAUSE -dBATCH -sDEVICE=ps2write -sOutputFile=output.ps -c "<</PSDocOptions (<</Duplex true>> setpagedevice)>> setdistillerparams" -f input.pdf Above

How do I convert RMarkdown ioslides presentations to 2-up PDFs programmatically?

大兔子大兔子 提交于 2021-02-10 12:29:27
问题 I use rmarkdown to generate ioslides HTML presentations, using custom css. This bit is great and I love it. My question is about generating 'notes' versions of presentations. The only way I've seen to get 2up PDF A4 notes from these slides is to print out of Safari, by clicking Print..., then landscape, then layout 2pages, then border = hairline, then save as. then find the right folder etc. However, it gets the formatting and fonts right, and Webkit renders things that Chrome or other

Need to Programmatically Convert PDF Paper Size (e.g. US-Letter to A4) in Python (or command line) [closed]

帅比萌擦擦* 提交于 2021-02-10 12:16:50
问题 Closed . This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this post. Closed 4 years ago . Improve this question I need to convert PDF documents from one arbitrary page size to another. For example, I might have a bunch of PDF documents formatted for us-letter paper (8.5" x 11") that I need to convert to the A4 paper size (21 cm x 29.7 cm), or I might need to convert A3

Need to Programmatically Convert PDF Paper Size (e.g. US-Letter to A4) in Python (or command line) [closed]

别说谁变了你拦得住时间么 提交于 2021-02-10 12:03:07
问题 Closed . This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this post. Closed 4 years ago . Improve this question I need to convert PDF documents from one arbitrary page size to another. For example, I might have a bunch of PDF documents formatted for us-letter paper (8.5" x 11") that I need to convert to the A4 paper size (21 cm x 29.7 cm), or I might need to convert A3

Python: Overlap between two functions (PDF of kde and normal)

别说谁变了你拦得住时间么 提交于 2021-02-10 09:44:35
问题 Short summary: Im trying to figure out how to calculate overlap between two functions. One is a gaussian, the other is a kernel density, based on data. Then, I would like to make a small algorithm that choose the mean and variance for the gaussian, which maximises overlap Firstly, needed imports: import numpy as np import matplotlib.pyplot as plt import seaborn as sns from scipy.stats.kde import gaussian_kde import scipy I have some data which is approximately normal (somewhat heavy right