Copying PDF seems to currupt it

I am copying a pdf from a source directory, then attempting to extract the pdf with pdfbox 0.7.3
the code I am using to copy the file is
public static boolean altCopyFile( File source, File dest )
long len = 0;
boolean success = false;
FileChannel srcC = null;
FileChannel dstC = null;
try
  srcC = new FileInputStream( source ).getChannel();
  len = srcC.size();
  dstC = new FileOutputStream( dst ).getChannel();
  long offset = 0;
  while ( len > 0 )
   long count = dstC.transferFrom( srcC, offset, len );
   offset += count;
   len -= count;
  success = true;
catch ( IOException ioe )
}I also tryed
FileInputStream fis = new FileInputStream( source );
FileOutputStream fos = new FileOutputStream( dest );
byte[] buf = new byte[ 1024 ];
int count = 0;
while ( ( count = fis.read( buf ) ) != -1 )
fos.write( buf, 0, count );
...this indeed makes a copy of the file, but from this point onward, attempting to use PDFbox results in an error while extracting text, on either the original, or the copy. Does anyone see how this function could corrupt the source or destination pdf file?
as a side note both the source and destination pdf files are still viewable in any pdf viewer.

yes I am closing the channels,
the diff command shows a difference in the files
before and after the copy, what i can't understand is
how that code could be changing my source fileI do file copying all the time in much the same way as you have posted but I don't get this problem. Create a totally self contained example that illustrates your problem. If you don't solve your problem by writing this example (and people often do by taking this approach) then post it so others can help in diagnosing what you are doing wrong.

Similar Messages

  • Can't copy pdfs or songs onto my iPhone 4s

    After the latest software update, I can no longer copy pdfs to my iPhone 4s. In the past, I just dragged the pdf from my Mac onto my device in iTunes. Now, I can no longer do that. I also added the pdf to my iTunes library and tried to copy it to my phone from there and that did not work either. Then I realized that I could no longer manually copy songs from iTunes to my phone.
    I ran through some help documents and the only one that seemed to address this said that I had to uncheck "Prevent iPods, iPhones and iPads from syncing automatically" in iTunes preferences and then run Sync. However, I do not want to automatically sync because I do not want my entire, extensive library of songs on my phone. I want to just add items manually, especially pdfs that I would like to be able to read om my phone.
    Any help would be greatly appreciated.

    the videos were in the correct format because i even made a new copy in itunes for ipod/iphone but it was not letting me sync neither videos or music but i fixed it the issue was that i was using a different usb cord than the original becuase mine was tolen so i bought one in ebay and i was using that one to sync my stuff and it was not letting me i was not getting any error message or anything it was like just syncing but nothing was being transfer to my phone so what i did was used the original usb cable from my ipod touch to try and sync and it worked. because i resetted to as new and everything but it was not working until i used the original usb cord to do it Thanks for answering

  • Getting an error while copying pdf file into RMS enabled document library using copyTo() method

    In SharePoint 2010, I am trying to copy pdf file programmatically from a non-RMS protected document library into RMS protected library using copyTo() method.
    But I am getting an error while doing so. it gives error as mentioned below -
    This library does not accept files of the given type. You must either upload a
    new, unprotected file that supports rights management or re-upload a document
    that was previously downloaded from this library.
    Please suggest some solution.
    Thanks,

    Are You sure that you have give 'PDF' in caps in your program? and check whether you are getting all the datas before calling the method.
    in my program, i have used like this and it is working fine for me,
    I am getting PDF content from the form...
    DATA  ls_formoutput     TYPE fpformoutput.
      DATA  pdf_content        TYPE solix_tab.
      DATA  lp_pdf_size        TYPE so_obj_len.
    DATA  lv_mail_title      TYPE so_obj_des.
    *Attach the PDF .
          lp_pdf_size = XSTRLEN( ls_formoutput-pdf ).
          pdf_content = cl_document_bcs=>xstring_to_solix(
              ip_xstring = ls_formoutput-pdf ).
          document->add_attachment(
            i_attachment_type     = 'PDF'
            i_att_content_hex     = pdf_content
            i_attachment_size     = lp_pdf_size
            i_attachment_subject  = lv_mail_title ) .

  • I'm runnin XI Pro and since returning from Xmas break having difficulty copying pdfs from incoming e

    I'm running XI Pro and since returning from Xmas break have had difficulty copying pdfs from incoming emails into a folder on my computer.  They eirther don't copy across, random pdfs display or Copy & Replace message appears when there are no pdfs in view.

    Hello Charles,
    I would be concerned too if my MacBook Prowas running slowly.  I found a couple of articles I recommend to help isolate and troubleshoot this issue.
    I recommend reviewing this article first for possible causes of the slowness:
    OS X Mavericks: If your Mac runs slowly
    http://support.apple.com/kb/PH13895
    You can further isolate the issue by determining if it is only happening in your user account or if it is happening system-wide:
    Isolating an issue by using another user account
    http://support.apple.com/kb/TS4053
    Thank you for using Apple Support Communities.
    Best,
    Sheila M.

  • How to copy pdf files from computer to ipad

    how to copy pdf files from computer to ipad

    You can PDFs to the iPad, but first you need one or more apps on the iPad that supports PDFs - unlike a 'normal' computer the iPad doesn't have a file system, and everything on it has to be associated with an app.
    Options include free apps such as Apple's iBooks app and also Adobe Reader - and paid-for apps such as GoodReader (which also supports read-only of other documents types).
    For iBooks you can first add the PDFs to your computer's iTunes via File > Add To Library, and you can then sync them by selecting the iPad on the left-hand sidebar of your computer's iTunes (on iTunes 11 you can enable the sidebar via option-command-S on a Mac, control-S on a PC) and using the Books tab on the right-hand side to select and sync them.
    For Adobe Reader adnd GoodReader you can use the file sharing on the Apps tab on the right-hand side to copy them over : http://support.apple.com/kb/ht4094

  • Copy PDF within Portfolio

    Feature Request: Copy PDF within Portfolio
    Within an Acrobat Portfolio, you cannot select a PDF, drag the selection with the CTRL, and have Acrobat make a copy of the PDF. The "copy" and "paste" are grey when a PDF is selected. Often I want to make a copy of a PDF and make numerous modifications to the copy. Currently, I have to export the original PDF, and then import it again with a different name to make a copy in the Portfolio. I hope you can add this feature. Thanks

    With Adobe Reader you can copy data, but to create a new PDF with the copied data you need Acrobat or http://createpdf.acrobat.com/

  • Can not copy PDF from "FP_TEST_00 " to Zform.

    Hi guru,
    I copied PDF from "FP_TEST_00" to Zform then active it, the message is displayed " No layout  exists  in original language  EN"
    Could  you please explain that and how to fix it.
    Thank you so much.
    Abaper.

    I guess, that you have not installed forms design tool on your desktop
    Also read SAP Note 801524. If everythin is done. follow the below steps
    After copying the PDF form "FP_TEST_00" to Z*, you need to create a layout to activate the new form.
    Steps for layout creation,
    1) Goto SFP
    2) Give you new form name Z* and press change
    3) Press layout button(Control + f12)
    4) Build your layout
    Regards,
    saiRam

  • Copy PDFs to computer

    I have 159 PDFs that I downloaded on my iPad from the Internet, not bought through iTunes. Mostly lecture notes. They're all saved in iBooks.
    I'd like to copy them all to my computer.
    None of the show up in the "Books" tab of my iPad in my computer's iTunes when I have it connected with the USB cable, so Syncing it through that isn't working.
    Is there some way to just copy and paste them over? I've been struggling for almost two hours on what I would have thought was a very simple task. Does Apple not support copy and paste?
    It seems I don't have access to iBooks PDFs through Windows Explorer either, only my camera roll?
    How do I access my files? WHY IS THIS SO HARD?

    I think I finally managed to find some third party software which is able to unchildproof the file transfer a bit and let me do what I want. Got my files off.
    Still interested about more legitimate ways to do it, if anyone has answers.

  • Problem with Copying PDFs to any application other than iBooks

    OK here is my problem,
    I used to be able to associated PDFs with other PDF readers (via iTunes > APPS > File Sharing). I just dragged and dropped and all was right in my world. However, all of a sudden this stopped working. I have no clue as to what caused this problem to arise. The only thing I remember 'doing' was adding some new apps.
    I cannot use the PDFs through iBook, well I can but it doesn't meet my needs (highlighting, copying and pasting and adding notes). So instead I want to use PDF HD. I used to have on PDF Masker and Good Reader, but neither does what I want.
    Suggestions?

    Hello Sin K,
    so proxy and Tomcat are located on different machines as well? Is the proxy able to commuicate with the Tomcat on the configured internal ports and is the proxy able to lookup the hostname you configured for the Tomcat?
    For the connector, the proxyName and proxyPort should be the parameters the client uses to call APEX. So if your clients should call via http://proxyserver:8080/testsin/apex the settings would be
    proxyName=proxyserver
    proxyPort=8080Reason for this is that applications (e.g. the APEX Listener) generate there URL references with these parameters.
    But does your proxy actually serve on port 8080? And is that port accessible by clients? Do clients accept cookies from that server?
    In my case, there is only one 302 which redirects to http://host:port/apex/f?p=4500:1000:sessionid which is correct.
    If you look into your first post request in firebug, what's in the request header?
    -Udo

  • Dev question: how to prevent Adobe Reader from copying pdfs to "Download/Adobe Reader"?

    I am making an app that downloads pdf files from a server and the users can decide to store them in the phone. Those files are kept in the app's private storage.
    The pdf files can be opened from inside the app. The problem is that every time a pdf is opened, adobe reader copies it in "Download/Adobe Reader" (the path may be different depending on the device and the android version). Those pdf files should not be available from outside my app. How can I prevent adobe reader from creating copies in that folder? Do I really have to make my app track them down and delete them? It wouldn't be the safest solution...
    In order to open the files, I se up a content provider:
    from the manifest:
    <provider
        android:name="android.support.v4.content.FileProvider"
        android:authorities="com.example.myapp.fileprovider"
        android:exported="false"
        android:grantUriPermissions="true" >
        <meta-data
            android:name="android.support.FILE_PROVIDER_PATHS"
            android:resource="@xml/filepaths" />
    </provider>
    And then, in a method, I do this:
    File pdfToRead = new File(pdfPath);
    Uri uri = FileProvider.getUriForFile(context, "com.example.myapp.fileprovider", pdfToRead);
    for (ResolveInfo resolveInfo : appsList) {
        String packageName = resolveInfo.activityInfo.packageName;
        context.grantUriPermission(packageName, uri, Intent.FLAG_GRANT_READ_URI_PERMISSION);
    openPDF(context, uri);
    public static final void openPDF(Context context, Uri localUri) {
        Intent i = new Intent(Intent.ACTION_VIEW);
        i.setDataAndType(localUri, PDF_MIME_TYPE);
        context.startActivity(i);
    Thanks for the help.

    Meh, I just hoped there was a way to tell acrobat "don't create a copy of the file because it's private". For now, I'm detecting the "downloads/Adobe Reader" folder, look if there's the file that was opened and delete it.
    Now I need to know something that I can't ask on stackoverflow: what paths does Adobe Reader use to create the "Adobe Reader" folder? Because not every device has an external sd card (external, not removable. Just for clarity). In my device it's at "Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS)+"/Adobe Reader".

  • How To Copy pdf file to word

    I would like to save file from pdf to word.How I can do that?Please give me for detail?
    Regards
    Dean

    Hi Mike, hi Bart,
    thanks for the suggestions. Challenge with .doc documents is often that they get displayed differently on different systems, and lots of people just do it in really crappy ways (not using styles, or using them completely wrong).
    Copying from PDF to word works if there's not much formatting, but in most cases it messes things up from my experience.
    I'll be looking for convert from PDF to word stuff. Thanks again,
    Bob

  • Pdf seems slow to redraw on ipad

    Hi,
    I've developed a portfolio pdf that's portrait and for ipad viewing – approx 60 pages. I want to keep the res high so there's some zooming capability for when clients want to see the finer detail.
    Problem I am having is once saved out of Indesign (and have tried various way and settings) and dowloaded through acrobat reader on ipad 3 I am experiencing a redraw issue.
    Approx 3 to 5 seconds to load a page after a swipe to go next. Then when zoom in takes while to sharpen and blurs or even not show page content until screen moved or touched to refresh.
    I use it to sit and go through my work with clients on a one-to-one basis but busier creative directors just like to quickly flick through pages as know what they are looking for.
    With the redraw and sometimes having to move or touch the device to get it to render as blank looks a bit unthoughabout and awkward which wasn't a way i'd like to sell myself.
    It could be so good and get good comments when people see but the glitches are a big down side.
    I have this same pdf saved at ipad size that I can view on iPhone 5 (through reader app) and it's pretty perfect and instant page turn.
    Any suggestions or settings that will give me excellent res and more instant content rather than white pages for 4 seconds?? Would be appreciated.
    Have tried flattening layers of PSD's and jpeging in Photoshop then reimporting in indesign as well as lower res flat files and also screen settings and 144dpi images. Nothing seems to solve.
    Likewise tried interactive and print res. Print res a better result.

    [topic moved to iOS subforum]

  • Can't copy pdf via drag & drop to iBooks

    Hi everybody,
    I wanted to copy some PDFs to my iPad via drag & drop and iTunes but I am suffering under the problem that nothing happens.
    I even get not displayed a "+" on my cursor and everything I have tried, nothing is copied to the ipad..
    iPad is running under iOs 4.3 and iTunes is up-to-date.

    I thought you were trying to find out how to drag and drop PDF files in your iTunes library in order to sync to your iPad but there are ways of sending files without syncing.
    If it is just a PDF file - not a book - you can attach the file to an email and send it yourself from your computer to the iPad, open it and choose the option of open in iBooks. When you open the file in your email, tap the curved arrow icon in the upper right corner and select open in iBooks. Then the PDF will be stored in books for later viewing.
    You can also sync PDF files with apps like Dropbox using WiFi. There are other apps available that will do the same thing.

  • Copying PDF into Excel

    Hi,
    Is there a way to insert or copy a pdf into an excel document.
    When i have a pdf open i click on edit and then click on copy file to clipboard
    I then go into excel and click on paste and it pastes (i think as an image) the first page of the pdf which is brilliant.  but i need to be able to see the other pages of the pdf as the pdf has multiple pages?
    Also, if i'm in excel and try it a different way by clicking on insert and then object and then selecting a pdf document i get an error saying that excel can't insert the object?

    You need Adobe Acrobat to do so. On a machine with Adobe Acrobat installed, open the pdf and use Export option to export the pdf file in a format you want.

  • Copying PDF data to context

    Hi,
    I am working on Web Dynpro  Java (SP 13) offline forms.
    User has to fill the form offline and upload it. Data will be copied to web dynpro  application.
    I am using WDInteractiveFormHelper.transferPDFDataIntoContext method for coping data.
    If the file is in correct format data is getting copied to context.
    Only problem is, if user uploaded PDF document in some different format(with different XML schema), we need to display error message to the user. How can I check if execution of method "WDInteractiveFormHelper.transferPDFDataIntoContext"; is successful?
    So that I can display error message & stop the document from getting uploaded(copying binary data).
    Any ideas?
    Thanks,
    Apurva

    hi do like this::
    *-- Convert the OTF data to PDF data
          CALL FUNCTION 'CONVERT_OTF_2_PDF'
               EXPORTING
                    use_otf_mc_cmd         = 'X'
               IMPORTING
                    bin_filesize           = v_bin
               TABLES
                    otf                    = lt_otf
                    doctab_archive         = it_doctab
                    lines                  = lt_pdfdata
               EXCEPTIONS
                    err_conv_not_possible  = 1
                    err_otf_mc_noendmarker = 2
                    OTHERS                 = 3.
    Regards
    Ashok P

Maybe you are looking for

  • HP laptop update failed, and now it wont stop undoing changes.

    When I went on my laptop today it started updating, and after an hour when it finally got to 99% it said they the update failed, and it's now undoing changes. It's been like that for over 3 hours now. How can I try to fix this?

  • How do I achieve this effect with a drop cap letter?

    How do I achieve this effect with a drop cap letter as shown in the picture below in indesign?: Thanks.

  • Report layout - ME2N - Automatic background job

    HI all We are using the above report for Pending PO-RElease ie., dynamic selection - release indicator "B"  thru automatic background programme schedueld thru SM36 (after setting the variant) for the relevant/concerned users. The issue is, the report

  • Acrobat X Context Menu

    Hello, some days ago I installed Acrobat X coming from Acrobat 9. With Acrobat 9 I could use the conext menu in the windows explorer to creat of some files a pdf file. Now with the X Version there isn't any context menu in the windows explorer from A

  • Error when Building on CVI 2013 XmlReader fails to load

    Thsi occurs during a code build under LabWindows CVI 2013 (FDS Version 13.0.2 (278) Windows 7 64 But Enterprise The builds completes and is functional. However midway through the builds the error windows pops open and returns the following. This is a