none
Printing customized paper size of PaperSize.RawKind 256. RRS feed

  • Question

  • I use the wpf / xps print technology, and I want to print with user custom paper size.

    But if PaperSize.RawKind is 256 and this printing paper size is different of the printer driver's default size,

    it is returned to the printer driver's default size.

    How can I resolve this task ?

    • Visual Studio 2010 Professional
    • Windows 7 SP1 (Language : Japanese)
    • .NET Framework 4.0
    • Using WPF / Xps print technology
    Tuesday, April 29, 2014 6:19 AM

Answers

All replies

  • Hi Fujiwara,

    The PrintDocument.PrinterSettings.PaperSizes collection has all the supported paper size for the printer which you are using. The PrintDocument.PrinterSettings has all kinds of information for the printer you have set. Use the following code to see all of them.

    private PaperSize GetPaperSize(int rawKind)
    
    {
    
        PaperSize papersize = null;
    
        foreach(PaperSize item in printdocument.PrinterSettings.PaperSizes)
    
        {
    
            if(item.RawKind == rawKind)
    
            {
    
                papersize = item;
    
                break;
    
            }
    
        }
    
        return papersize;
    
    }
    

    For your question, I think what you have set was illegal for printer. So the printer use the default PageSize. Try the above code and let me know the result.

    Regards,


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Wednesday, April 30, 2014 1:57 AM
    Moderator
  • Thank you for reply.

    I surmise that the customized paper size on printing is enable or disable with "PaperSize.RawKind" value.

    1. Set some size "A" to the paper by the printer driver property dialog.
    2. Set  another size "B" to the paper when trying to print.
    3. If the above paper's RawKind is not 256, actual printed paper size is the above "A" (printer driver default size). If the above paper's RawKind is 256, actual printed paper size is the above "B" (customized size on printing).

    Is this the printer driver or Windows's specifications ?


    • Edited by H.Fujiwara Wednesday, April 30, 2014 2:46 AM
    Wednesday, April 30, 2014 2:45 AM
  • Hi Fujiwara,

    Could you please try printing using another printer if possible? As I know, problem may be caused by printer as the following link. http://social.msdn.microsoft.com/Forums/vstudio/en-US/a230b087-ed7a-447e-a3cc-30dcdf09ec7e/how-to-use-a-custom-papersize?forum=csharpgeneral.

    Regards,


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Wednesday, May 7, 2014 5:32 AM
    Moderator