PDF page cannot be counted

hi,
i have a problem while counting the pages for a PDF file.
Note:
The pdf file size is more than 1.5 GB. if the pdf size with in 1 MB then there is no problem, if it's size is 1.5 GB then only we are getting following error.
Error message :
Exception in thread "main" java.lang.OutOfMemoryError: Java heap space
import java.io.File;  
import java.io.FileInputStream;
import com.lowagie.text.pdf.PdfReader;  
public class CreateIndexFiles1 {  
public static void main(String[] args) {  
File f = new File("C:\\xxx\\yyyy\\");  
File listOfFile[] = f.listFiles();  
for(int i = 0; i < listOfFile.length; i++) {  
File tempFile = listOfFile;
String fileName = tempFile.getName();
System.out.println("File Name = " + fileName);
try {  
if(fileName.toLowerCase().indexOf(".pdf") != -1) {  
//PdfReader document = new PdfReader(fileName);
//int noPages = document.getNumberOfPages();
     //File pdffile =new File(f + fileName);
PdfReader document = new PdfReader(new FileInputStream(listOfFile[i]));
int noPages = document.getNumberOfPages();
System.out.println("Number of Pages in the PDF document = " + noPages);
catch(Exception e) {  
System.out.println("Exception : " + e.getMessage());
e.printStackTrace();
Can any one please give some suggestion to over come this problem?

I believe that iText reads and stores the complete PDF in memory when you get a page count. You will need to give the application 1.5GB (plus a little for overhead) or use a different PDF lib.

Similar Messages

  • Cannot drag and drop PDF pages in Yosemite Preview App

    I suddenly cannot drag and drop PDF pages into the open preview PDF Yosemite> Why?
    I open a PDF in preview.
    I used to be able to simply drag a PDF from the desktop (or a JPG) into that open PDF in Preview.
    Now it won;t let me?
    Is this a bug or is there a new procedure for this?
    Thanks!
    Mike

    Have you run any "cleaning" or "optimizing" apps on your Mac or have any antivirus software installed?
    Boot into the Recovery volume (boot with the Command + R keys held down), select Disk Utility and repair both the disk permissions and the disk.  Reboot normally and try again.
    If the above fails reboot into the Recovery volume and reinstall the system. Repair disk permissions afterward.
    Also, as a test, log into another user account on your Mac and see if the problem persists there.  If it does then it's a system wide issue.  If not, it's an account issue.

  • Getting fast PDF page count (without opening file)?

    I’ve got a menu with about 100 PDFs and for various
    reasons I’d like to display the page count for each. I could
    enter the page count by hand but that becomes a maintenance
    nightmare as the PDFs are updated and someone (myself included)
    will forget to update the count. Opening each PDF in an xtra to get
    the page count would be too slow for 100 documents . I’ve
    found a dll that claims to parse the PDF header and quickly count
    PDF pages which might work (we’re already using dllBinder for
    MAPI access) although I haven’t started experimenting with
    it. Has anyone tried something similar? Can I parse the header with
    lingo/Buddy API and avoid working with the dll black box?

    I would take an approach in between the extremes you listed.
    Consider
    this. Make a list of all the documents, and make an automated
    process
    using Impressario or something to get the total pages in all
    100
    documents. Save this list. It will take a bit to open and
    close all
    the docs, but it only need to be done once. From then on,
    compare to
    the saved list. Whenever a doc gets changed use your
    automated
    Impressario process to update the list.
    If the DLL route doesn't pan out, then that is how I would go
    about it.
    You;d still need to remember to update your list after every
    change,
    but at least it is an automatic process.

  • How do I: put multiple PDF pictures into one PDF page?

    I have just installed Adobe Acrobat Pro Ver 9 - so this apllication and its associated SDK are the only applications available to me for use.
    Adobe Acrobat was chosen because of its AutoCAD capabilities (when AutoCAD is not present). i.e.  Using Acrobat & AutoCAD's plot configuration files & Pen / colour selection table ensures the output has correct line thicknesses (sometimes colours in CAD are used to represent a line's thickness) - this is preserved when using Acrobat.
    The generated output is fantastic. However, when I try to print the output via Excel / Word (used for layout) - my perfect output is reduced to imperfect results.
    So: is it possible to layout multiple PDF pictures inside one PDF entity for printing purposes such that the original output is not distorted?
    I have in the past put pages in front or behind other pages but cannot find any references or code that works with Pro 9 nor indeed the manual way to insert PDF pages at any location on a single PDF Page?
    I'll try and explain.  My template coud consist of 6 boxes on a single A4 page thus:
    My base PDF Page (can be thought of as a template - ideally it wont be printed - but even if it is - it wont be printed on any media material) has 6 areas (any number of areas up to 100) on it.  In each area, there is a box.  It is within these boxes that I wish to place a PDF Picture.  Not all pictures will be the same.  How can I do that?  Ideally I'd like some example C# code - though doing it as a user will suffice, for now.
    Is there a way of programmatically selecting each of the above boxes on the base PDF Document?
    I do know of one manual method (though it seems long winded) and it is not accurate enough in that (even though the layers are deselected) - the hidden layers are subsequently outputed too - not good!
    Uses a button icon over each box.
    All the current Adobe help for the SDK refers to Pro 8 and previously - which all seems to have now been replaced in Pro 9
    This question will be placed in the Developer & User Forums - as it pertains to both.
    Thankyou in advance for anyone that either knows any workarounds or any ways to affect a solution. 

    Picture of what I want to see:
    What I get, and don't want to see is:
    The PDF was generated using Adobe Acrobat Pro 9 from an AutoCAD LT (DWG) file without AutoCAD being present but making use of a plot configuration (PC3) file & pen table (CTB) file.  The resultant file [WhatIWantToSee.pdf] is perfect - all the lines are the right thickness & colour and are perfect vectors (with no construction / proofing layers visible).  When you view that file in Acrobat and show the "Layers" property box, you see that the correct number of layers whilst are still present are indeed turned off.
    However, when I add a forms-button to one of the rectangles (please refer to initial post - where there are 6 rectangles), and display same file as icon display.  The resultant view is the one shown above named [ What I get and don't want to see].  It seems the saved layer settings are all ignored?
    I generated the PDF file through Adobe Acrobat Pro 9  Menu | File | Create PDF | From File (Files of type Autodesk) | Options | Selected Layers | Layout | Last Active Layout.
    Rectangles are regular content elements - not fields (in the general meaning of form-fields).

  • Question: Is there a way to create a PDF from outlook e-mail that does not embed the attachment? better, is there a way to convert the e-mail with attachement (not embeded) as pdf pages? - Problem: I have 1400 e-mails with attachments that need to be conv

    Is there a way to create a PDF from outlook e-mail that does not embed the attachment? better, is there a way to convert the e-mail with attachement (not embeded) as pdf pages?
    - Problem: I have 1400 e-mails with attachments that need to be converted into pdf and the attachments cannot be embeded.
    System: PC Windows 7 using Acrobat X Prof. - Thank you!

    Hi ,
    There is an option of embedding index for faster search while converting email to a PDF .
    However I am not sure that will serve your purpose or not .
    I would recommend you to get in touch with Microsoft support as well .
    Meanwhile I'll work on it and get back to you in case I get a desired solution .
    Regards
    Sukrit Dhingra

  • Unable to generate out put to file & page cannot be displayed

    Hi I created one report in ids 10.2 on windows but when i am trying to call the report thru form its generating in cache but not displaying any output.How can i generate the output in a pdf file and open in the browser.I am using web_show.document but still getting error pls find my following code.I already put file and need to generate an output file,its showing the message REPORT WAS CORRECTLY RUN and opening a new page with jobid
    like this
    http://test.com/rwservlet/getjobid=_54?server=test
    and giving error page cannot displayed
    IF get_application_property(user_interface) = 'WEB' THEN
    report_id:= FIND_REPORT_OBJECT('test');
    set_report_object_property(report_id, REPORT_COMM_MODE, SYNCHRONOUS);
    set_report_object_property(report_id, REPORT_EXECUTION_MODE, runtime);
    set_report_object_property(report_id, REPORT_DESTYPE,file);
    set_report_object_property(report_id, REPORT_DESFORMAT, 'PDF');
    report_job_id := RUN_REPORT_OBJECT(report_id);
    rep_status:=REPORT_OBJECT_STATUS(report_job_id);
    WHILE rep_status in ('RUNNING','OPENING_REPORT','ENQUEUED')
    LOOP
    rep_status := report_object_status(report_job_id);
    END LOOP;
    IF rep_status='FINISHED' THEN
    message('REPORT WAS CORRECTLY RUN');
    end if;
    JOB_NUMBER := length(server_name) + 1;
    WEB.SHOW_DOCUMENT ('http://test.com/rwservlet/getjobid='||substr(report_job_id,JOB_NUMBER)||'?server=' || server_name ,'_BLANK');
    end if;
    rgds
    shrey

    Hi
    I think you didnt got my problem correctly,i tried that and its showing page cannot displayed.if i run this report with full paramters in the URL its showing the result,if i put this in web_show.document parameter aslo its displaying the output
    http://test.com/reports/rwservlet/getjobid54?server=test will showing page cannot displayed
    if i put full parameters
    http://test.com/reports/rwservlet/server=test&report=d:\test.rdf&destype=cache&desformat=pdf&userid=test/test@bac
    it will generate the file to client
    rgds
    shrey

  • How to export antialiased images of PDF pages?

    Hello all:
    I recently upgraded to Acrobat XI, and I am surprised to see that you STILL cannot export (or Save As) PDF pages to images that are ANTIALIASED!? Does anyone have a simple answer for this that doesn't involve a workflow of more than 5 steps? This is so headslappingly obvious a need that I'm at a loss for what Adobe's engineers are thinking when programming the Save As Image functions...
    I posted this question all the way back in 2009 (see post at http://forums.adobe.com/message/2411677#2411677), and still the answer is the same: when Acrobat saves pages as TIF or JPEG files, they are ALIASED. Who would want that? Who?! WHY?
    It's simply exasperating that Adobe does not include a tiny, little check box that says "Antialiased" in the "Save As TIF / JPEG Settings" dialog box where you set all kinds of parameters like resolution and colorspace....If the exporting process would just include antialiasing, you could set the resolution you desire and YOU'RE DONE.
    But, as far as I can tell, you still have to perform some kind of gymnastic routine like:
    Open the PDF and select all the desired page thumbnails to export.
    Right-click and choose Extract Pages. Make sure to check "Extract Pages as Separate Files."
    Export all the separate PDFs for each desired page into a folder somewhere.
    Open Photoshop and start recording an Action.
    Open one of the PDFs and specify the desired resolution.
    Save it in a desired location in an image file of your choice (TIF/JPEG).
    Stop recording the Action.
    Delete the resulting image you made of the test PDF page to avoid an overwriting error later when running the batch (or check box to overwrite in batch dialog).
    Run the Action in Batch mode on the entire folder of separate PDF pages.
    This is preposterous.
    Adobe, please get the simple things right for everyday low-level users before adding feature bloat to Acrobat with each passing version. Please.

    Hi Dave: Good points about reducing feature bloat and installer footprint taking priority for most users...
    However, if, as you say:
    Acrobat and Adobe Reader are developed as a standalone product family....
    Ultimately, since you can get an AA bitmap of a PDF file by just opening it in Photoshop etc., there is very little commercial demand for Adobe to include that feature in Acrobat.
    then, those people who do not have Photoshop (because AA is designed to be standalone, right?) cannot access antialiasing in exporting PDF images at all! Your point is exactly my point.
    If there is so little demand, then why include Export to Image functionality at all? Just eliminate it completely to save installer footprint space!....But, then, I'm sure you realize people would complain about that immediately, no? So, again, why include it at all when it's only able to export aliased images which virtually nobody is going to want? That's very passive-aggressive toward's Adobe's users. Nobody really benefits from half-baked features only begrudgingly included in software to placate the vocal minority of users who would otherwise miss it. I realize this isn't a huge issue for most users, but I think this points to a larger mentality within Adobe and the software industry in general....
    There is a huge number of people working in corporations that own legacy versions of AA who have not and will not likely subscribe to Creative Cloud! (e.g.: The 100-person architecture/engineering firm I worked at for 10 years had one copy of Photoshop on a community graphics workstation and made everyone use a sign-up sheet to access it.)
    Also, it's nice in theory that PDFs are supposed to be a print format. But, many many times, AA users have to make images (for PowerPoint, blogs, client portals etc.) from PDFs that they did not originally create and do not have the source files to recreate or export as images from their originating software. PDF export to images from Acrobat is their only choice without access to Photoshop.
    And, if AA is truly designed to be a stand-alone product, untethered from the capabilities of the entire suite of functionality across Creative Cloud apps, then a modular plug-in approach to controlling feature bloat would be more appropriate, no?
    For example, AutoCAD is a giant, sprawling application for technical drawing. And AutoDesk has recognized over the years that AutoCAD is used by many industries, each with special needs unneccesary to other industries' user base. So, they've created add-on packs of plug-ins that transform vanilla AutoCAD into AutoCAD for Architecture, Civil Engineering, Electrical Engineering, Bridge Design, Home Building, etc....see where I'm going?
    And Adobe has a far larger installed user base for Acrobat than AutoDesk does for AutoCAD! How about plugins like AA for Technical Publishing, AA for 3D modeling, AA for Presentations?...

  • Merging PDF / Page Numbers / Acrobat SDK V9  & LiveCycle

    Hello everyone,
    I use Adobe LiveCycle to create forms, Visual Studio 2005 and the Acrobat SDK for the application I'm programming to fill in these forms. The application fills in the forms and merges them with no issues.
    The problem I have is that these pages have page numbers in the upper right. I use the Page N of M object on these forms in LiveCycle. PDF page numbers are filled in correctly when filling in the forms, but when I merge PDFs, the pages keep their original page numbers. I've looked at the Windows - Interapplication Communications even using templates to no avail.
    How can I merge these pdf's and have my program renumber these pages correctly and how can insert pages anywhere I want in the merge document?
    Below is the code I use to merge the PDF's. It was posted in a forum.
    Sub MergePDF(ByVal ThePath As String, ByVal outFileName As String)
    On Error GoTo serror
    Dim dPDDocMerge As New Acrobat.AcroPDDoc
    Dim dPDDoc As New Acrobat.AcroPDDoc
    Dim strFiles() As String
    Dim numPage As Integer
    Dim TotalPage As Integer
    Dim objThisFile As IO.FileInfo 'get FileInfo object for file string
    strFiles = System.IO.Directory.GetFiles(ThePath) ' Read in the file names
    Dim b As Boolean ' mostly for testing purposes... could use it for error 'checking to make sure that a file is really added before deleleting it...
    For i As Integer = 0 To strFiles.Length - 1 ' run through all the files in 'the directory
    objThisFile = New IO.FileInfo(strFiles(i)) ' Get the extension
    If objThisFile.Extension = ".pdf" Then ' Only add in PDFs
    If dPDDocMerge.GetFileName = "" Then ' check if it's the first file
    dPDDocMerge = New Acrobat.AcroPDDoc
    b = dPDDocMerge.Open(strFiles(i)) ' open first file
    TotalPage = dPDDocMerge.GetNumPages
    Else
    dPDDoc = New Acrobat.AcroPDDoc
    b = dPDDoc.Open(strFiles(i)) ' open other files
    numPage = dPDDocMerge.GetNumPages ' get the page count
    TotalPage += numPage
    b = dPDDocMerge.InsertPages(numPage - 1, dPDDoc, 0, dPDDoc.GetNumPages, _ False) ' Insert
    End If
    End If
    Next
    'b = dPDDocMerge.Save(1, ThePath & "\" & outFileName) ' save file
    b = dPDDocMerge.Save(1, ThePath & "\" & "\MyTest.PDF") ' save file
    b = dPDDocMerge.Close()
    Exit Sub
    serror:
    MsgBox(ErrorToString)
    End Sub
    Thanks for any code or advice.

    You can't merge LiveCycle forms this way :(. LC forms are NOT standard PDF files and can't be processed in the same way.

  • Icon size for audio file insert on a PDF page.

    Acrobate X V10.1.9 Windows 7.
    I wish to insert an audio file on a pdf page. I select "multimedia", "sound". Get the window to select the file. Once selected I then find that I cannot size the icon that appears on the page (click to play). The two fields are grayed out. If I click "OK" it results in a very large "click to play" icon. I cannot resize the icon on the page..
    Does this function require C++? Have been getting an error message on PC startup about something being in error. I click OK and all seems to be working ok.
    Any ideas?
    Thanks,
    Joe

    You can crop it, but the size will not change to letter. However, after cropping, you can print with expand to fit page selected. If you like you can expand this to a new PDF using print, though not generally the recommended approach. Do you have any idea how it was reduced in the first place? If so, have you tried the reverse process?

  • Print by choosing paper source by PDF page size from MAC

    I have an iMAC with Maverick OS.  I am printing to both an HP 401 monochrome laser printer and an HP Laser Jet Pro CM1415fnw Color Printer.  I receive .pdf files which contain both letter and legal sized pages.  I know that I cannot print out letter and legal size pages by selecting "choose paper source by PDF page size" from my MAC.  This does present a problem for me (and I'm sure many others).  What I would like to know is 1) is there a way around this problem and 2) are there any plans for Adobe to address a resolution to this issue by fixing the option so that MAC users can achieve the same level of ease of print results as Window users?  There is certainly a large segment of the population who are now MAC users.  Thank you.

    Thanks for the suggestion, Steve.  I did go to that link and asked the same
    information of Adobe directly.  Their NB at the bottom of the page says
    that due to the large number of questions asked and information requested,
    they usually do NOT respond to the users.  Too bad.  How else are we
    supposed to get valid info?  I believe almost all the other software
    vendors do have a contact location from which they will address user's
    concerns and will contact you with some kind of info.  Welcome to the new
    world of customer service!!  i.e., Go figure it out by yourself!!
    Mitch
    M. Mitchell Gordon
    [personal information removed by moderator]

  • I have created numerous forms in Designer and for some reason, "Edit in Designer" from PDF, I cannot edit any of the fields in Design View.

    I have created numerous forms in Designer and for some reason, "Edit in Designer" from PDF, I cannot edit any of the fields in Design View.

    Is it possible you accidentally put the fields on the master page?

  • The page cannot be displayed (message when

    Hi together,
    since a couple of weeks, I have the problem with the message above in subject. My Client tries to access a "news" document which is - so I think - created by XMLForms Builder. When he clicks on the link, he got the message "The page cannot be displayed. The page you are looking for is currently unavailable. ....".
    I have checked the IE option settings. Therefore, we have a PDF document with all required settings. I had also the same problem which has been fixed after I have made changes on my settings but that has no effect on my Client's PC.
    I need an urgent idea / solution how to fix that. Thanks for helps
    Cengiz

    If this is an XE installation it would probably be best addressed in the Oracle XE forum. Having said that, I had a similar problem on my Windoze machine and needed to uninstall all previous Oracle client products.
    The basic problem (for me) was that the operating environment (path and environment variables) is not properly prepared to run the XE database and web server. Removing the other Oracle client apps removed the conflicting and offending environment settings and all works well.
    For further info you might want to go to that Oracle XE forum.
    Earl

  • How do I disable audio on a pdf page when opening a link that also has audio?

    Hi,
    I have a pdf page that has audio that plays when the page is visible. I set the "disable" audio to happen when the page is no longer visible. That works great. However, I have a link on the pdf page that opens an attached pdf page. I specifically want that linked page to open in a new window. It just so happens that the attached page also has audio. I cannot find a way to disable the first audio. As it is now, both audios play at the same time.
    Thanks for any help you can give on this!

    Please repost in the Acrobat Scripting forum.

  • PDF Page Extraction issue

    Hi all,
    i have  single pdf file with many pages, on that i cannot able to extract some pdf pages on the file, we receiving error
    "There was as problem reading this document (15)"
    Please help me how to find the error without using acrobat. If any error code is present in the pdf file data to get.
    Please help me to solve the issue.
    Regards,
    JayaKrishnan

    Thanks for your reply on helping this issue
    Please tell the option in acrobat to validate the document on this exact error.
    And also help me to find the error without opening the pdf file through acrobat.
    Thanks Regards,
    JayaKrishnan

  • The page cannot be displayed while running the report with web link

    Hello,
    I tried to run the report using a web link similar:
    http://hostname/reports/rwservlet?report=WRFTCKL.rdf&userid=use/pass@datbase&desformat=pdf&destype=CACHE&paramform=yes
    I am able to see the parameter form, but after I entered some parameter and submit, I got an error as:
    The page cannot be displayed.
    But if I run it with the paramform=no and attached the parameter/value pair at the end of the link, the report will show on the web.
    Anyone knows what is wrong?
    Thanks.

    try this sample report from
    http://www.alexyscorp.com/products.htm
    (Download the Forms Reports Integration based on run_report_object (FMB,RDF) )

Maybe you are looking for