Solved

VB.net Open a pdf file in resources

Posted on 2014-11-20
3
458 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 48

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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

A while ago, I was working on a Windows Forms application and I needed a special label control with reflection (glass) effect to show some titles in a stylish way. I've always enjoyed working with graphics, but it's never too clever to re-invent …
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

758 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now