Click here to Skip to main content
12,354,349 members (68,054 online)
Rate this:
 
Please Sign up or sign in to vote.
See more: C#3.0 C#
Hello,

I have a variable that contains a name that I recover the database. and I want my pdf file is created with the name that is in my variable.

how I put the variable name in the file path ?
knowing that I program with c #.


string name;

try
          {
              PdfWriter wri = PdfWriter.GetInstance(doc, new FileStream("c:/Users/User/Desktop/Application/"pdf_name".pdf", FileMode.Create));
 
              doc.Open();

thanks
Posted 25-Sep-12 23:18pm
Comments
Andrei Straut 26-Sep-12 5:34am
   
Try:
PdfWriter wri = PdfWriter.GetInstance(doc, new FileStream("c:/Users/User/Desktop/Application/" + pdf_name + ".pdf", FileMode.Create));
Sushil Mate 26-Sep-12 5:35am
   
what's the problem?
Member 9410354 26-Sep-12 6:09am
   
thanks
I tried it but it does nothing
Member 9410354 26-Sep-12 6:14am
   
is solved!
thank you all

1 solution

Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 1

Try Following use + before and after
pdf_name
 
<pre lang="cs">try
          {
              PdfWriter wri = PdfWriter.GetInstance(doc, new FileStream(&quot;c:/Users/User/Desktop/Application/&quot;+pdf_name+&quot;.pdf&quot;, FileMode.Create));
 
              doc.Open();</pre>
  Permalink  
Comments
Member 9410354 26-Sep-12 6:14am
   
is solved!
thank you all

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy | Mobile
Web02 | 2.8.160621.1 | Last Updated 26 Sep 2012
Copyright © CodeProject, 1999-2016
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100