| Author |
Message |
|
|
Hi Patrick,
After a long time, this issue exist,
Please fix it asap, I am waiting for
this issue removal.
Best Regards,
~Iqubal Mustafa Kaki
|
 |
|
|
Thanks Patrick for the reply...
But the issue is remain, either I change BufferedImage.OPAQUE,
BufferedImage.BITMASK, or BufferedImage.TYPE_INT_ARGB,
Now I am sending the pdf, please run this code with that pdf,
you can understand my issue more clearly.
So please if u have any suggestion then please suggest me.
Best Regards,
Er.IMKAKI
patrick.corless wrote:
Double check that the viewer reference implementation is correstly renderign the PDF in question. If it is rendering ok then you can try the following getPageImage modifcation
Code:
public Image getPageImage(int pageNumber,
final int renderHintType, final int pageBoundary,
float userRotation, float userZoom) {
Page page = catalog.getPageTree().getPage(pageNumber, this);
PDimension sz = page.getSize(pageBoundary, userRotation, userZoom);
int pageWidth = (int) sz.getWidth();
int pageHeight = (int) sz.getHeight();
BufferedImage image = new BufferedImage(pageWidth,
pageHeight,
BufferedImage.[b]TYPE_INT_ARGB[/b]);
Graphics g = image.createGraphics();
page.paint(g, renderHintType,
pageBoundary, userRotation, userZoom);
g.dispose();
catalog.getPageTree().releasePage(page, this);
return image;
}
|
 |
|
|
Hi,
First of all I will thanks to the team of ICEPdf, Because now I am able to render PDF version 1.6.
Now I am facing another problem, While I am rendering the pages as images, It is not capturing the transparent images of that pdf page.
At the position of transparent images it is showing white back ground.
I am using the following code:
import org.icepdf.core.exceptions.PDFException;
import org.icepdf.core.exceptions.PDFSecurityException;
import org.icepdf.core.pobjects.Document;
import org.icepdf.core.pobjects.Page;
import org.icepdf.core.util.GraphicsRenderingHints;
import javax.imageio.ImageIO;
import java.awt.image.BufferedImage;
import java.awt.image.RenderedImage;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
public class PDFPageCapture {
public static void main(String[] args) {
// Get a file from the command line to open
// String filePath = args[0];
// open the file
Document document = new Document();
try {
document.setFile("D:/Ebook/JpegToPDF/pdf/alberta-justice-success-story.pdf");
} catch (PDFException ex) {
System.out.println("Error parsing PDF document " + ex);
} catch (PDFSecurityException ex) {
System.out.println("Error encryption not supported " + ex);
} catch (FileNotFoundException ex) {
System.out.println("Error file not found " + ex);
} catch (IOException ex) {
System.out.println("Error IOException " + ex);
}
// save page captures to file.
float scale = 1.0f;
float rotation = 0f;
// Paint each pages content to an image and
// write the image to file
for (int i = 0; i < document.getNumberOfPages(); i++) {
BufferedImage image = (BufferedImage) document.getPageImage(i,
GraphicsRenderingHints.PRINT, Page.BOUNDARY_CROPBOX,
rotation, scale);
RenderedImage rendImage = image;
try {
System.out.println(" capturing page " + i);
File file = new File("D:/Ebook/JpegToPDF/images/imageCapture1_" + i + ".gif");
ImageIO.write(rendImage, "gif", file);
} catch (IOException e) {
e.printStackTrace();
}
image.flush();
}
// clean up resources
document.dispose();
}
}
So, Please if any one have any solution, then please suggest me.
|
 |
|
|
|
|