Results 1 to 9 of 9

Thread: C# printing     submit to reddit submit to twitter

  1. #1
    Relic Horn
    Join Date
    Dec 2007
    Posts
    3,411
    BG Level
    7
    FFXIV Character
    Purrrfect Lee
    FFXIV Server
    Hyperion
    FFXI Server
    Cerberus

    C# printing

    Ok so, I have acrobat installed on my pc and if I open a text file in notepad I can print it and select Distiller and make a pdf. I'm trying to make a little program to do the same thing, by letting the user pick a folder that has text files in it. I'm fine with the little printer settings window popping up (for now), I just need a way to say 'take this list of txt files and make pdfs, NAO!' How do I just print like a basic windows app?

    edit: Sort of got it by mangling a MS example, but not very happy with it. Drops all the files to the desktop by default. >.>

  2. #2
    Banned.

    Join Date
    Jul 2005
    Posts
    5,821
    BG Level
    8
    FFXI Server
    Sylph
    WoW Realm
    Arthas

    If I understand your problem, you're able to print but not select a list of files? If so:

    Use the OpenFileDialog and set the Multiple File setting to true. This will return an array of files to print.
    If you're looking for directory support, use the FolderBrowserDialog component and loop through the Files. You can also use DirectoryInfo to get the files and then print the them.

    Let me know if this helps.

  3. #3
    Relic Horn
    Join Date
    Dec 2007
    Posts
    3,411
    BG Level
    7
    FFXIV Character
    Purrrfect Lee
    FFXIV Server
    Hyperion
    FFXI Server
    Cerberus

    I already had an arraylist I was going through with all of the files to print, the key was getting them to print to a specific folder/filename w/o needing the user. Fortunately I was just printing text files and found a library on codeproject that someone made to make pdfs from text files. Worked well and waaaaay faster than waiting for distiller to do stuff.

  4. #4
    Banned.

    Join Date
    Jul 2005
    Posts
    5,821
    BG Level
    8
    FFXI Server
    Sylph
    WoW Realm
    Arthas

    Why are you turning things into PDF's before you print them? See this:
    http://msdn.microsoft.com/en-us/library/ms996472

    All you need to do is make a print class and then loop through your text file's and send them to the printer. I'm not sure where the extra steps are coming in at.

  5. #5
    Relic Horn
    Join Date
    Dec 2007
    Posts
    3,411
    BG Level
    7
    FFXIV Character
    Purrrfect Lee
    FFXIV Server
    Hyperion
    FFXI Server
    Cerberus

    That is a nice link, looks like a lot of good stuff there. Unfortunately the people at work have problems when ANYTHING is changed or improved. So since they have always gone to folder X and print whatever pdfs are there, that is all they can handle. Really the project was just to save some time for other IS people that have been making these pdfs from inside a program that is very shitty to use and takes them way longer than it should, but the program automatically makes these text files so I just made something to convert them and keep the production people happy.

  6. #6
    Banned.

    Join Date
    Jul 2005
    Posts
    5,821
    BG Level
    8
    FFXI Server
    Sylph
    WoW Realm
    Arthas

    So were you printing to pdf or printing to the printer?

  7. #7
    Relic Horn
    Join Date
    Dec 2007
    Posts
    3,411
    BG Level
    7
    FFXIV Character
    Purrrfect Lee
    FFXIV Server
    Hyperion
    FFXI Server
    Cerberus

    PDF

  8. #8
    Banned.

    Join Date
    Jul 2005
    Posts
    5,821
    BG Level
    8
    FFXI Server
    Sylph
    WoW Realm
    Arthas

    Oh that makes more sense. What did you end up solving this with?

  9. #9
    Relic Horn
    Join Date
    Dec 2007
    Posts
    3,411
    BG Level
    7
    FFXIV Character
    Purrrfect Lee
    FFXIV Server
    Hyperion
    FFXI Server
    Cerberus

    http://www.codeproject.com/KB/graphi...texttopdf.aspx with a couple tweaks just to add some info at the beginning of the file. Worked very well, though I did come across an interesting issue where if a '1' was printed in the very first position on the page it would insert a blank page. I guess acrobat interpreted that differently than expected.

Similar Threads

  1. linux printing issues
    By saracrow in forum Tech
    Replies: 0
    Last Post: 2010-03-31, 17:25
  2. Printing photos
    By Correction in forum Tech
    Replies: 0
    Last Post: 2009-11-27, 13:01
  3. Print Screen
    By Celeste in forum Tech
    Replies: 6
    Last Post: 2009-07-09, 11:03
  4. Word won't print
    By Avé in forum Tech
    Replies: 5
    Last Post: 2007-07-10, 22:04