pdfrenderer

PdfRendering zoom on page

三世轮回 提交于 2021-02-19 04:17:55
问题 I'm working on a project where I need to display PDF content inside our application. I'm trying to use PdfRenderer of Android API. For now, I'm able to show a pdf page as bitmap and move between all other pages. But I don't understand how to implement zoom on a page. I mean I know how to zoom an image, but for pdf it needs to be recalculated at every zoom level (such as tile ?). On zoom I need to recalculate Bitmap with correct Rect and Matrix I guess, that's the point I'm missing. Does some

PDFBox: put two A4 pages on one A3

旧巷老猫 提交于 2020-01-25 20:41:10
问题 I have a pdf document with one or more pages A4 paper. The resulting pdf document should be A3 paper where each page contains two from the first one (odd on the left, even on the right side). I already got it to render the A4 pages into images and the odd pages are successfully placed on the first parts of a new A3 pages but I cannot get the even pages to be placed. public class CreateLandscapePDF { public void renderPDF(File inputFile, String output) { PDDocument docIn = null; PDDocument

PDFBox: put two A4 pages on one A3

孤者浪人 提交于 2020-01-25 20:41:02
问题 I have a pdf document with one or more pages A4 paper. The resulting pdf document should be A3 paper where each page contains two from the first one (odd on the left, even on the right side). I already got it to render the A4 pages into images and the odd pages are successfully placed on the first parts of a new A3 pages but I cannot get the even pages to be placed. public class CreateLandscapePDF { public void renderPDF(File inputFile, String output) { PDDocument docIn = null; PDDocument

PDF Library for Android - PDFBox? [closed]

久未见 提交于 2019-12-28 02:39:27
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 5 years ago . Wich libraries exists to use to draw PDF files on Android? I found PDFBox, that is a JSE Library, and want to know if somehow it can be used to draw the PDFs on Android. I know Android converts Standard bytecodes into Dalvik Bytecodes, but how it will convert classes like BufferedImage that the framework can

JavaFX printing non node objects

人走茶凉 提交于 2019-12-21 21:48:53
问题 I want to print a PDFFile object from the Pdf-Renderer library using javafx printing. Is it possible to print non Node objects? Currently i'm using AWT printing (check this example) but it doesn't go well with javafx because my javafx window freezes when the AWT print dialog comes up. Printer printer = Printer.getDefaultPrinter(); PageLayout pageLayout = printer.createPageLayout(Paper.A4, PageOrientation.PORTRAIT, Printer.MarginType.DEFAULT); PrinterJob job = PrinterJob.createPrinterJob(); if

CGContextDrawPDFPage memory Leak - App Crash

狂风中的少年 提交于 2019-12-18 07:52:12
问题 When I analyze my app with Instruments, I found out that data allocated by CGContextDrawPDFPage is not released immediately. App getting crash because of CGContextDrawPDFPage . Hello here is my code for drawing pdf in CATiledlayer - (void)drawLayer:(CATiledLayer *)layer inContext:(CGContextRef)context { if (_PDFPageRef == nil) { return; } CGPDFPageRef drawPDFPageRef = NULL; CGPDFDocumentRef drawPDFDocRef = NULL; @synchronized(self) // Briefly block main thread { drawPDFDocRef =

How to increase the resolution of image in PDF renderer?

孤街浪徒 提交于 2019-12-17 19:50:03
问题 I want to increase the resolution of a image. I used PDFRenderer-0.9.0 jar . It is downloaded from java.net for converting PDF pages to images. I want to Convert 46_2.pdf PDF file to image . The converted 46_2.png image is small with dimensions 612 x 792 [ width x height ] , So I want to increase the image dimensions to 1200 x 1400 [ width x height] . I tried previously PdfBox for converting PDF page into PNG image file. There is a problem only page is converted but text is missing . So I

PDFrenderer setting scale to screen

社会主义新天地 提交于 2019-12-12 03:49:14
问题 Im using the code below to render a pdf. This is in a try/catch and works well, showing the pdf. The problem is that the pdf file is too big for the screen. Does anyone know how to scale it down to fit please? Thank you. imageView = (ImageView) findViewById(R.id.imagePDF); int REQ_WIDTH = imageView.getWidth(); int REQ_HEIGHT = imageView.getHeight(); Display display = getWindowManager().getDefaultDisplay(); Point size = new Point(); display.getSize(size); int width12 = size.x; int height12 =

PDFBox 2 unusual memory consumption

浪子不回头ぞ 提交于 2019-12-12 02:29:05
问题 We are trying to render images from different PDF files, using PDFRenderer's method renderImageWithDPI. On a particular PDF, for some pages, the library renderer has a different behaviour. The rendering itself takes way longer than for other similar pages, and the memory consumption reaches unusually big values: the memory consumed by the process goes up with about 50MB every 1 - 2 seconds, until it reaches values like 5GB of RAM consumed by the application process while in renderImageWithDPI

Add bookmarks in PDF files using PDFRenderer API

流过昼夜 提交于 2019-12-12 01:58:28
问题 I am using PDF Render for reading and updating PDF. I want to add bookmark in that PDF and update it using same API. Is it possible to do so with PDF Renderer? Here is some code snippet to update bookmarks in PDF which is not working File file = new File("C:\\test.pdf"); RandomAccessFile raf = new RandomAccessFile(file, "rw"); FileChannel channel = raf.getChannel(); ByteBuffer buf = channel.map(FileChannel.MapMode.READ_WRITE, 0, channel.size()); PDFFile pdffile = new PDFFile(buf); OutlineNode