Open linked PDF-Files from a PDF-File

Ask a Question related to ASP.NET General, Design and Development.

  1. #1

    Default Re: Open linked PDF-Files from a PDF-File

    Paul,
    Open up the PDF file using a FileStream, then read it in using a BinaryReader,
    then replace the URL links in the file, then write the file out to the Response.
    So something along the lines of:

    ' Open up the PDF file
    Dim fileName As String = New String("d:\\work\\test.pdf")
    Dim fileStream As System.IO.FileStream = New System.IO.FileStream(fileName, FileMode.Open, FileAccess.Read)
    Dim fileLength As Long = fileStream.Length

    ' Read the file in
    Dim binaryReader As System.IO.BinaryReader = New System.IO.BinaryReader(fileStream)
    Dim fileByteArray As Byte() = binaryReader.ReadBytes(CType(fileLength, Integer))
    fileStream.Close()

    ' Replace URL
    ' ToDo... Use fileByteArray.BinarySearch()

    ' Write out the PDF file
    Response.Clear()
    Response.Buffer = False
    Response.CacheControl = "public"
    Response.ContentType = "application/pdf"
    Response.AddHeader("Content-Length", fileLength.ToString())
    Response.AddHeader("Content-Disposition", "in-line; filename=" & "test.pdf")
    Response.BinaryWrite(fileByteArray)
    Response.End()

    --

    Thanks,
    Carl Prothman
    Microsoft ASP.NET MVP
    [url]http://www.able-consulting.com[/url]


    "Paul Kuebler" <pkuebler@palfinger.com> wrote
    > Hello
    >
    > I send a PDF-File with
    > string FilePath="PDFFiles\\Test1.pdf";
    > Response.ContentType="Application/pdf";
    > Response.WriteFile(FilePath);
    > Response.Flush();
    > Response.End();
    > to the client browser. In this PDF-File
    > are links to other PDF-Files. This PDF-files
    > are on the server in the same directory as Test1.pdf.
    > Is there a solution to open the selected
    > PDF-File. The link path in Test1.pdf to the
    > other PDF-files is only their filename.
    >
    > Thanks
    > Paul

    Carl Prothman [MVP] Guest

  2. Similar Questions and Discussions

    1. Cannot open Acrobat files with Foreign Characters in file name
      Someone sent me some pdf files with Hebrew characters in the name. They do not open unless I rename them with English characters. He says he can open...
    2. Duplicate files open anytime I open a file
      When I open an Illistratro file, two of the same file opens everytime. I browsed everyone of the subjects suggesting anything with the word...
    3. Can't open Illustrator 10 files with linked images
      I'm getting the spinning cursor when trying to open Illustrator 10 files with linked images. This problem isn't happening with files containing...
    4. Illustrator CS files with large linked files results in large file size
      If I place a large linked Photoshop 7 file (.psd or.eps), say 36 MB, in Illustrator CS and save without embedding the file it takes ages to save and...
    5. File.open{} , huge files and gc
      I just came across a diuscussion about C++ smart pointers and Python's refcount GC. So I fall in the doubt: If I call File.open 'my_huge_file' {...
  3. #2

    Default Re: Open linked PDF-Files from a PDF-File

    "Paul Kuebler" <pkuebler@palfinger.com> wrote
    ?????????????????????????????????????????????????? ??????????????????????????????????????????????????
    ?????????????????????????????????????????????????? ??????????????????????????????????????????????????
    ?????????????????????????????????????????????????? ??????????????????????????????????????????????????
    ?????????????????????????????????????????????????? .?????????????????????????????????????????????????
    ?????????????????????????????????????????????????? ??????????????????????????????????????????????????
    ?????????????????????????????????????????????????? ??????????????????????????????????????????????????
    ?????????????????????????????????????????????????? ??????????????????????????????????????????????????
    ?????????????????????????????????????????????????? ??????????????????????????????????????????????????
    ?????????????????????????????????????????????????? ??????????????????????????????????????????????????
    ?????????????????????????????????????????????????? ??????????????????????????????????????????????????
    ?????????????????????????????????????????????????? ??????????????????????????????????????..?????????? ?
    ?????????????????????????????????????????????????? ??????????????????????????????????.???????????????
    ?????????????????????????????????????????????????? ??????????????????????????????????????????????????
    ?????????????????????????????????????????????????? ??????????????????????????????????????????????????
    ?????????????????????????????????????????????????? ??????????????????????

    Paul,
    If you have a question, then ask it. Otherwise please don't be rude...

    --

    Thanks,
    Carl Prothman
    Microsoft ASP.NET MVP
    [url]http://www.able-consulting.com[/url]




    Carl Prothman [MVP] Guest

  4. #3

    Default Re: Open linked PDF-Files from a PDF-File

    ?????????????????????????????????????????????????? ?????????????????????????????????????????????????? ?????????????????????????????????????????????????? ?????????????????????????????????????????????????? ?????????????????????????????????????????????????? ?????????????????????????????????????????????????? ?????????????????????????????????????????????????? ?????????????????????????????????????????????????? ?????????????????????????????????????????????????? ?????????????????????????????????????????????????? ?????????????????????????????????????????????????? ?????????????????????????????????????????????????? ?????????????????????????????????????????????????? ?????????????????????????????????????????????????? ?????????????????????????????????????????????????? ?????????????????????????????????????????????????? ????????????????..???????????????????????????????? ?????????????????????????????????????????????????? ?????????????.???????????????????????????????????? ?????????????????????????????????????????????????? ?????????????????????????????????????????????????? ?????????????????????????????????????????????????? ?????????????????????????????????????????????????? ?????????????????????????????????????????????????? ?
    Paul Kuebler Guest

  5. #4

    Default Re: Open linked PDF-Files from a PDF-File

    ?????????????????????????????????????????????????? ?????????????????????????????????????????????????? ?????????????????????????????????????????????????? ?????????????????????????????????????????????????? ?????????????????????????????????????????????????? ?????????????????????????????????????????????????? ?????????????????????????????????????????????????? ?????????????????????????????????????????????????? ?????????????????????????????????????????????????? ?????????????????????????????????????????????????? ?????????????????????????????????????????????????? ?????????????????????????????????????????????????? ?????????????????????????????????????????????????? ?????????????????????????????????????????????????? ?????????????????????????????????????????????????? ?????????????????????????????????????????????????? ?????????????????????????????????????????????????? ?????????????????????????????????????????????????? ?????????????????????????????????????????????????? ?????????????????????????????????????????????????? ?????????????????????????????????????????????????? ?????????????????????????????????????????????????? ?????????????????????????????????????????????????? ?????????????????????????????????????????????????? ?????????????????????????????????????????????????? ?????????????????????????????????????????????????? ?????????????????????????????????????????????????? ?????????????????????????????????????????????????? ????????>
    Paul Kuebler Guest

  6. #5

    Default Open linked PDF-Files from a PDF-File

    ?????????????????????????????????????????????????? ?????????????????????????????????????????????????? ?????????????????????????????????????????????????? ?????????????????????????????????????????????????? ?????????????????????????????????????????????????? ?????????????????????????????????????????????????? ?????????????????????????????????????????????????? ?????????????????????????????????????????????????? ?????????????????????????????????????????????????? ?????????????????????????????????????????????????? ?????????????????????????????????????????????????? ??????????

    Paul Kuebler Guest

  7. #6

    Default Open linked PDF-Files from a PDF-File

    Sorry for this bad post, but I copied source-code into
    the post, and the result are question marks!!

    Paul
    >-----Original Message-----
    >????????????????????????????????????????????????? ?????????
    ?????????????????????????????????????????????????? ?????????
    ?????????????????????????????????????????????????? ?????????
    ?????????????????????????????????????????????????? ?????????
    ?????????????????????????????????????????????????? ?????????
    ?????????????????????????????????????????????????? ?????????
    ?????????????????????????????????????????????????? ?????????
    ?????????????????????????????????????????????????? ?????????
    ?????????????????????????????????????????????????? ?????????
    ??????????????????????????????
    >
    >.
    >
    Paul Kuebler Guest

  8. #7

    Default Re: Open linked PDF-Files from a PDF-File

    "Paul Kuebler" <pkuebler@palfinger.com> wrote
    > Sorry for this bad post, but I copied source-code into
    > the post, and the result are question marks!!
    >
    Ahhh, I was wondering what you were doing! ;-)

    Try copying the code to Notepad, then copy from Notepad to here.

    --

    Thanks,
    Carl Prothman
    Microsoft ASP.NET MVP
    [url]http://www.able-consulting.com[/url]



    Carl Prothman [MVP] Guest

  9. #8

    Default Re: Open linked PDF-Files from a PDF-File

    ?????????????????????????????????????????????????? ?????????????????????????????????????????????????? ?????????????????????????????????????????????????? ?????????????????????????????????????????????????? ?????????????????????????????????????????????????? ?????????????????????????????????????????????????? ?????????????????????????????????????????????????? ?????????????????????????????????????????????????? ?????????????????????????????????????????????????? ?????????????????????????????????????????????????? ?????????????????????????????????????????????????? ?????????????????????????????????????????????????? ?????????????????????????????????????????????????? ?????????????????????????????????????????????????? ?????????????????????????????????????????????????? ?????????????????????????????????????????????????? ?????????????????????????????????????????????????? ?????????????????????????????????????????????????? ?????????????????????????????????????????????????? ?????????????????????????????????????????????????? ????????????????????????????..???????????????????? ?????????????????????????????????????????????????? ?????????????????????????.???????????????????????? ?????????????????????????????????????????????????? ?????????????????????????????????????????????????? ?????????????????????????????????????????????????? ?????????????????????????????????????????????????? ?????????????????????????????????????????????????? ?????????????
    Paul Kuebler Guest

  10. #9

    Default Re: Open linked PDF-Files from a PDF-File

    "Paul Kuebler" <pkuebler@palfinger.com> wrote
    ?????????????????????????????????????????????????? ????????????????????????????

    Paul,
    Which tool are you using to post to the newsgroups?

    --

    Thanks,
    Carl Prothman
    Microsoft ASP.NET MVP
    [url]http://www.able-consulting.com[/url]




    Carl Prothman [MVP] Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139