Solved

VB.net Open a pdf file in resources

Posted on 2014-11-20
3
552 Views
Last Modified: 2014-11-23
Hi
I imported a pdf doc called test.pdf into my project resources and tried to open it using the following code
but I got the error shown in the image

Imports System.IO  
Imports System.Diagnostics  

        Dim pdf As Byte() = My.Resources.test

        Using tmp As New FileStream("test.pdf", FileMode.Create)

            tmp.Write(pdf, 0, pdf.Length)
        End Using

        Process.Start("test.pdf")

1
0
Comment
Question by:murbro
3 Comments
 
LVL 50

Accepted Solution

by:
Rgonzo1971 earned 250 total points
ID: 40454740
Hi,

Maybe instead of FileMode.Create

FileMode.OpenOrCreate

or

FileMode.Open

Regards
0
 
LVL 11

Assisted Solution

by:LordWabbit
LordWabbit earned 250 total points
ID: 40455032
The line Process.Start("test.pdf") has opened the document in Acrobat, find all instances of Acrobat that are currently running and stop them.
0
 

Author Closing Comment

by:murbro
ID: 40461500
thanks for the help
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article explains how to create and use a custom WaterMark textbox class.  The custom WaterMark textbox class allows you to set the WaterMark Background Color and WaterMark text at design time.   IMAGE OF WATERMARKS STEPS Create VB …
It’s quite interesting for me as I worked with Excel using vb.net for some time. Here are some topics which I know want to share with others whom this might help. First of all if you are working with Excel then you need to Download the Following …
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

713 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question