Wrox Programmer Forums
Go Back   Wrox Programmer Forums > C# and C > C# 1.0 > C#
|
C# Programming questions specific to the Microsoft C# language. See also the forum Beginning Visual C# to discuss that specific Wrox book and code.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the C# section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old October 3rd, 2007, 08:48 AM
Registered User
 
Join Date: May 2007
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default How to access PDF files from Visual C#

Dear all,

I am trying to figure out how I can access the text in a PDF file from a C# Windows application. I would have thought this shouldn't be too difficult using the Acrobat API. Specifically, I would like to do the following:

- Get a string from the user
- Get a PDF file name from the user
- Check, if the string is contained in the text of the PDF file

I checked various forums and sites, but got lost trying to include the Acrobat DLLs and making them work through the API. The above should only require a few lines of code. Could anyone point me to a useful web source or code snippets that I can exploit?
Thanks a million in advance.

Kind regards,

Martin

 
Old October 5th, 2007, 09:42 AM
Authorized User
 
Join Date: Nov 2006
Posts: 93
Thanks: 0
Thanked 1 Time in 1 Post
Default

Martin,

I'm not familiar with the Acrobat API but I've done some work with other APIs. Generally, I find the issues with passing parameters are related to marshalling. When you define the exported API function for use in your code you have to marshal string parameters as UnmanagedType.LPStr as in this definition:

        [DllImport("piapi32.dll", SetLastError = false,
            CharSet = CharSet.Ansi, EntryPoint = "piut_login",
            CallingConvention = CallingConvention.StdCall)]
        protected static extern Int32 piut_login(
            [MarshalAs(UnmanagedType.LPStr)] String Username,
            [MarshalAs(UnmanagedType.LPStr)] String Password,
            ref Int32 Access);

Note that the returned integer and referenced integer parameter didn't require any special treatment.

Hope this helps.


What you don't know can hurt you!





Similar Threads
Thread Thread Starter Forum Replies Last Post
read pdf files in C# prasannatele Visual Studio 2005 0 September 12th, 2007 05:46 AM
Upload pdf files yanis97 JSP Basics 3 April 23rd, 2007 11:43 PM
Access hyperlinks to pdf files lryckman Access 1 March 13th, 2007 06:53 AM
Opening PDF files comicghozt ASP.NET 1.0 and 1.1 Professional 11 October 23rd, 2006 04:06 AM
Creating PDF Files aldwinenriquez ASP.NET 1.0 and 1.1 Professional 3 January 12th, 2006 06:43 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.