top of page
destcocegalring

Get Printer Driver By Printer Name Vb Net Data: A Step-by-Step Guide to Using the EnumPrinters API



As dowski suggested, you could use WMI to get printer properties. The following code displays all properties for a given printer name. Among them you will find: PrinterStatus, Comment, Location, DriverName, PortName, etc.


As an alternative to WMI you can get fast accurate results by tapping in to WinSpool.drv (i.e. Windows API) - you can get all the details on the interfaces, structs & constants from pinvoke.net, or I've put the code together at -printer-status-using-winspool.html




Get Printer Driver By Printer Name Vb Net Data



Typically, you access a PrinterSettings through PrintDocument.PrinterSettings or PageSettings.PrinterSettings properties to modify printer settings. The most common printer setting is PrinterName, which specifies the printer to print to.


Print Management provides up-to-the-minute details about the status of printers and print servers on the network. You can use Print Management to install printer connections to a group of client computers simultaneously. Print Management can help you find printers that have an error condition by using filters. It can also send e-mail notifications or run scripts when a printer or print server needs attention. On printer models that provide a printer Web page, Print Management has access to more data, such as toner and paper levels, which you can manage from remote locations, if needed.


To remove a printer with Windows PowerShell, I use the Remove-Printer function from the PrinterManagement module. There are two ways to use the Remove-Printer function:


What this means is that if I type the exact printer name, I can use the Remove-Printer function directly. It also tells me that I can pipe a printer object to the function. By pipelining a printer object, I can use wildcard characters.


I usually begin things by using a Get type of command. So the first thing I do is use the Get-Printer function to see what printers are defined. The command is shown here:


I can use the Remove-Printer function directly to remove a printer if I know the exact name. If I am unsure of the printer name, I use the Get-Printer function to list my printers, and I copy and paste the name. With quick edit mode turned on, I can highlight the printer name with my mouse, press ENTER to copy it to the clipboard, and then right-click to paste it. This is shown in the image that follows.


  • I downloaded the report to my desktop ,the document was downloaded with correct content .Then i used PrintDocument to print the document in my desktop ,junk values were printing .I think its some issue with PrinterSettings property.\\nExportFormatType formatType = ExportFormatType.NoFormat; formatType = ExportFormatType.PortableDocFormat; ObjDoc.ExportToDisk(formatType, exportPath + "\\\\\\\\UndertakingDoc.pdf"); ObjDoc.Dispose(); PrintDocument pd = new PrintDocument(); pd.PrinterSettings.PrintFileName= exportPath + "\\\\\\\\UndertakingDoc.pdf"; pd.PrinterSettings.PrinterName = cmbPrinter.SelectedValue.ToString().Trim();\\n\\npd.Print();\\n \",\"author\":\"username\":\"vamsikris27\",\"displayName\":\"vamsi krishna\",\"groupIcons\":[],\"suspended\":false,\"isCurrentUser\":false,\"parentAuthor\":\"username\":\"pguss_sri\",\"displayName\":\"Patrick Guss\",\"groupIcons\":[],\"suspended\":false,\"isCurrentUser\":false,\"id\":13584391,\"creationDate\":1644741084000,\"activeRevisionId\":14069071,\"lastActivity\":1644741084000,\"parentId\":13576975,\"originalParentId\":13577942,\"likeCount\":0,\"visibility\":\"full\",\"depth\":0,\"attachments\":[],\"canVoteUpOrCancel\":false,\"relations\":\"canReport\":false,\"visibility\":\"full\",\"canEdit\":false,\"canUseDelete\":false,\"isLiked\":false,\"type\":\"comment\",\"canVoteUpOrCancel\":false,\"canConvertToAnswer\":false,\"canBeModerated\":false,\"canViewRevisions\":false,\"showInReply\":false,\"reported\":false,\"canCancelReport\":false,\"canDelete\":false,\"canVoteDownOrCancel\":false,\"canComment\":false,\"canViewReports\":false,\"isCurrentUserAuthor\":false,\"liked\":false,\"moderatorComment\":false}]},\"13583517\":\"rootParentId\":13583517,\"commentsCount\":1,\"comments\":[\"body\":\"There is no viewer in my project ,i load the report and send directly to printer without a viewer .I could export to disk successfully with correct content .But when i try to print directly to printer i get junk values in print out ,there are no boxes .Please find attached screenshot of the printout .I get around 15 -20 pages of single line printed on each page as below screenshot \\n\",\"author\":\"username\":\"vamsikris27\",\"displayName\":\"vamsi krishna\",\"groupIcons\":[],\"suspended\":false,\"isCurrentUser\":false,\"parentAuthor\":\"username\":\"don.williams\",\"displayName\":\"Don Williams\",\"groupIcons\":[\"name\":\"moderator\",\"title\":\"This user is an SAP Moderator\",\"priority\":20,\"name\":\"employee\",\"title\":\"This user is an SAP Employee\",\"priority\":21],\"suspended\":false,\"isCurrentUser\":false,\"id\":13584611,\"creationDate\":1644905932000,\"activeRevisionId\":14069338,\"lastActivity\":1644905932000,\"parentId\":13583517,\"originalParentId\":13577942,\"likeCount\":0,\"visibility\":\"full\",\"depth\":0,\"attachments\":[\"id\":2024589,\"fileName\":\"junk.jpg\",\"size\":\"82.4 kB\",\"url\":\"/storage/attachments/2024589-junk.jpg\",\"isImage\":true],\"canVoteUpOrCancel\":false,\"relations\":\"canReport\":false,\"visibility\":\"full\",\"canEdit\":false,\"canUseDelete\":false,\"isLiked\":false,\"type\":\"comment\",\"canVoteUpOrCancel\":false,\"canConvertToAnswer\":false,\"canBeModerated\":false,\"canViewRevisions\":false,\"showInReply\":false,\"reported\":false,\"canCancelReport\":false,\"canDelete\":false,\"canVoteDownOrCancel\":false,\"canComment\":false,\"canViewReports\":false,\"isCurrentUserAuthor\":false,\"liked\":false,\"moderatorComment\":false],\"13584998\":\"rootParentId\":13584998,\"commentsCount\":1,\"comments\":[\"body\":\"As you said it was printer driver issue.In WPF VS2017 ,when we are printing what ever driver name is printed on the physical printer .The printer needs to be installed with the exact driver name .If there is even a slight mismatch in the driver name ,it was causing junk values to be printed when printing programmatically through VS2017.Normal printing will work if there is mismatch in drivers.Also this issue is not there in VS2010 with Webforms .I have tested this in 2 printers in different countries and i was able to print successfully. \",\"author\":\"username\":\"vamsikris27\",\"displayName\":\"vamsi krishna\",\"groupIcons\":[],\"suspended\":false,\"isCurrentUser\":false,\"parentAuthor\":\"username\":\"ido.millet\",\"displayName\":\"Ido Millet\",\"groupIcons\":[],\"suspended\":false,\"isCurrentUser\":false,\"id\":13587187,\"creationDate\":1645101412000,\"activeRevisionId\":14073040,\"lastActivity\":1645101412000,\"parentId\":13584998,\"originalParentId\":13577942,\"likeCount\":0,\"visibility\":\"full\",\"depth\":0,\"attachments\":[],\"canVoteUpOrCancel\":false,\"relations\":\"canReport\":false,\"visibility\":\"full\",\"canEdit\":false,\"canUseDelete\":false,\"isLiked\":false,\"type\":\"comment\",\"canVoteUpOrCancel\":false,\"canConvertToAnswer\":false,\"canBeModerated\":false,\"canViewRevisions\":false,\"showInReply\":false,\"reported\":false,\"canCancelReport\":false,\"canDelete\":false,\"canVoteDownOrCancel\":false,\"canComment\":false,\"canViewReports\":false,\"isCurrentUserAuthor\":false,\"liked\":false,\"moderatorComment\":false],\"13585222\":\"rootParentId\":13585222,\"commentsCount\":1,\"comments\":[\"body\":\"I downloaded the report to my desktop ,the document was downloaded with correct content .Then i used PrintDocument to print the document in my desktop ,junk values were printing .I think its some issue with PrinterSettings property.\\nExportFormatType formatType = ExportFormatType.NoFormat; formatType = ExportFormatType.PortableDocFormat; ObjDoc.ExportToDisk(formatType, exportPath + "\\\\\\\\UndertakingDoc.pdf"); ObjDoc.Dispose(); PrintDocument pd = new PrintDocument(); pd.PrinterSettings.PrintFileName= exportPath + "\\\\\\\\UndertakingDoc.pdf"; pd.PrinterSettings.PrinterName = cmbPrinter.SelectedValue.ToString().Trim();\\n\\npd.Print();\",\"author\":\"username\":\"vamsikris27\",\"displayName\":\"vamsi krishna\",\"groupIcons\":[],\"suspended\":false,\"isCurrentUser\":false,\"parentAuthor\":\"username\":\"don.williams\",\"displayName\":\"Don Williams\",\"groupIcons\":[\"name\":\"moderator\",\"title\":\"This user is an SAP Moderator\",\"priority\":20,\"name\":\"employee\",\"title\":\"This user is an SAP Employee\",\"priority\":21],\"suspended\":false,\"isCurrentUser\":false,\"id\":13584392,\"creationDate\":1644741175000,\"activeRevisionId\":14069072,\"lastActivity\":1644741175000,\"parentId\":13585222,\"originalParentId\":13577942,\"likeCount\":0,\"visibility\":\"full\",\"depth\":0,\"attachments\":[],\"canVoteUpOrCancel\":false,\"relations\":\"canReport\":false,\"visibility\":\"full\",\"canEdit\":false,\"canUseDelete\":false,\"isLiked\":false,\"type\":\"comment\",\"canVoteUpOrCancel\":false,\"canConvertToAnswer\":false,\"canBeModerated\":false,\"canViewRevisions\":false,\"showInReply\":false,\"reported\":false,\"canCancelReport\":false,\"canDelete\":false,\"canVoteDownOrCancel\":false,\"canComment\":false,\"canViewReports\":false,\"isCurrentUserAuthor\":false,\"liked\":false,\"moderatorComment\":false],\"13583683\":\"rootParentId\":13583683,\"commentsCount\":1,\"comments\":[\"body\":\"Hi,\\n I am using ReportDocuments PrintToPrinter method . \\nI was using Arial Font in the crystal report .I changed the Font to Consolas and i still get the same issue .\\nI can export to Disk successfully into PDF format ,only when i print a document i face the issue .\\nNo i didnt test using your printer test app because my requirement of project is that user shouldnt get an option where he chooses printer or number of copies ,no print dialog or any interface.\\n In CR Desginer,in the preview tab when i print the report by using print button i get junk value again. \",\"author\":\"username\":\"vamsikris27\",\"displayName\":\"vamsi krishna\",\"groupIcons\":[],\"suspended\":false,\"isCurrentUser\":false,\"parentAuthor\":\"username\":\"don.williams\",\"displayName\":\"Don Williams\",\"groupIcons\":[\"name\":\"moderator\",\"title\":\"This user is an SAP Moderator\",\"priority\":20,\"name\":\"employee\",\"title\":\"This user is an SAP Employee\",\"priority\":21],\"suspended\":false,\"isCurrentUser\":false,\"id\":13584931,\"creationDate\":1645008188000,\"activeRevisionId\":14069729,\"lastActivity\":1645008188000,\"parentId\":13583683,\"originalParentId\":13577942,\"likeCount\":0,\"visibility\":\"full\",\"depth\":0,\"attachments\":[],\"canVoteUpOrCancel\":false,\"relations\":\"canReport\":false,\"visibility\":\"full\",\"canEdit\":false,\"canUseDelete\":false,\"isLiked\":false,\"type\":\"comment\",\"canVoteUpOrCancel\":false,\"canConvertToAnswer\":false,\"canBeModerated\":false,\"canViewRevisions\":false,\"showInReply\":false,\"reported\":false,\"canCancelReport\":false,\"canDelete\":false,\"canVoteDownOrCancel\":false,\"canComment\":false,\"canViewReports\":false,\"isCurrentUserAuthor\":false,\"liked\":false,\"moderatorComment\":false],\"13583859\":\"rootParentId\":13583859,\"commentsCount\":1,\"comments\":[\"body\":\"Yes my default printer is not the same when i designed the report .The project was developed in a different country in VB.NET webforms and was running successfully.I changed to a different country and was converting the project to WPF from web forms and thats when the trouble started .The crystal reports .rpt files used are still from the older source.I thought may be thats the issue and created crystal reports new .rpt files in the WPF project .But still getting junk values. \\nI changed the printer drivers too and put settings similar to a printer from old source where printing was successful ,but still it prints same junk value. \\nI will use your test app and print now and get back to you soon.\",\"author\":\"username\":\"vamsikris27\",\"displayName\":\"vamsi krishna\",\"groupIcons\":[],\"suspended\":false,\"isCurrentUser\":false,\"parentAuthor\":\"username\":\"don.williams\",\"displayName\":\"Don Williams\",\"groupIcons\":[\"name\":\"moderator\",\"title\":\"This user is an SAP Moderator\",\"priority\":20,\"name\":\"employee\",\"title\":\"This user is an SAP Employee\",\"priority\":21],\"suspended\":false,\"isCurrentUser\":false,\"id\":13587096,\"creationDate\":1645075289000,\"activeRevisionId\":14069927,\"lastActivity\":1645075289000,\"parentId\":13583859,\"originalParentId\":13577942,\"likeCount\":0,\"visibility\":\"full\",\"depth\":0,\"attachments\":[],\"canVoteUpOrCancel\":false,\"relations\":\"canReport\":false,\"visibility\":\"full\",\"canEdit\":false,\"canUseDelete\":false,\"isLiked\":false,\"type\":\"comment\",\"canVoteUpOrCancel\":false,\"canConvertToAnswer\":false,\"canBeModerated\":false,\"canViewRevisions\":false,\"showInReply\":false,\"reported\":false,\"canCancelReport\":false,\"canDelete\":false,\"canVoteDownOrCancel\":false,\"canComment\":false,\"canViewReports\":false,\"isCurrentUserAuthor\":false,\"liked\":false,\"moderatorComment\":false]}"); const simplifiedQuestionView = JSON.parse("true"); (function() window.pageContext = mergeDeep(pageContext, question: id: 13577942, plug: "setting-printersettingsprintername-leads-to-printi", votes: 0, questionTitle: "Setting PrinterSettings.PrinterName leads to printing of junk value on print of crystal report", isClosed: false, isLocked: false, isRedirected: false, redirectedFromTitle: "", redirectedFromId: "", closedStatusData: JSON.parse(""), userVoted: false, relations: JSON.parse("\"canClose\":false,\"canUnredirect\":false,\"canReport\":false,\"visibility\":\"full\",\"canEdit\":false,\"canUseDelete\":false,\"canReopen\":false,\"type\":\"question\",\"canVoteUpOrCancel\":false,\"canViewRevisions\":true,\"canUnlock\":false,\"reported\":false,\"canVoteDownOrCancel\":false,\"canLock\":false,\"canCancelReport\":false,\"canComment\":true,\"isCurrentUserAuthor\":false,\"canViewReports\":false"), isQuestionAccepted: true , childToViewInfo: id: "" , comments: JSON.parse("\"13576975\":\"rootParentId\":13576975,\"commentsCount\":3,\"comments\":[\"body\":\"I downloaded the report to my desktop ,the document was downloaded with correct content .Then i used PrintDocument to print the document in my desktop ,junk values were printing .I think its some issue with PrinterSettings property.\\nExportFormatType formatType = ExportFormatType.NoFormat; formatType = ExportFormatType.PortableDocFormat; ObjDoc.ExportToDisk(formatType, exportPath + "\\\\\\\\UndertakingDoc.pdf"); ObjDoc.Dispose(); PrintDocument pd = new PrintDocument(); pd.PrinterSettings.PrintFileName= exportPath + "\\\\\\\\UndertakingDoc.pdf"; pd.PrinterSettings.PrinterName = cmbPrinter.SelectedValue.ToString().Trim();\\n\\npd.Print();\\n \",\"author\":\"username\":\"vamsikris27\",\"displayName\":\"vamsi krishna\",\"groupIcons\":[],\"suspended\":false,\"isCurrentUser\":false,\"parentAuthor\":\"username\":\"pguss_sri\",\"displayName\":\"Patrick Guss\",\"groupIcons\":[],\"suspended\":false,\"isCurrentUser\":false,\"id\":13584391,\"creationDate\":1644741084000,\"activeRevisionId\":14069071,\"lastActivity\":1644741084000,\"parentId\":13576975,\"originalParentId\":13577942,\"likeCount\":0,\"visibility\":\"full\",\"depth\":0,\"attachments\":[],\"canVoteUpOrCancel\":false,\"relations\":\"canReport\":false,\"visibility\":\"full\",\"canEdit\":false,\"canUseDelete\":false,\"isLiked\":false,\"type\":\"comment\",\"canVoteUpOrCancel\":false,\"canConvertToAnswer\":false,\"canBeModerated\":false,\"canViewRevisions\":false,\"showInReply\":false,\"reported\":false,\"canCancelReport\":false,\"canDelete\":false,\"canVoteDownOrCancel\":false,\"canComment\":false,\"canViewReports\":false,\"isCurrentUserAuthor\":false,\"liked\":false,\"moderatorComment\":false],\"13583517\":\"rootParentId\":13583517,\"commentsCount\":1,\"comments\":[\"body\":\"There is no viewer in my project ,i load the report and send directly to printer without a viewer .I could export to disk successfully with correct content .But when i try to print directly to printer i get junk values in print out ,there are no boxes .Please find attached screenshot of the printout .I get around 15 -20 pages of single line printed on each page as below screenshot \\n\",\"author\":\"username\":\"vamsikris27\",\"displayName\":\"vamsi krishna\",\"groupIcons\":[],\"suspended\":false,\"isCurrentUser\":false,\"parentAuthor\":\"username\":\"don.williams\",\"displayName\":\"Don Williams\",\"groupIcons\":[\"name\":\"moderator\",\"title\":\"This user is an SAP Moderator\",\"priority\":20,\"name\":\"employee\",\"title\":\"This user is an SAP Employee\",\"priority\":21],\"suspended\":false,\"isCurrentUser\":false,\"id\":13584611,\"creationDate\":1644905932000,\"activeRevisionId\":14069338,\"lastActivity\":1644905932000,\"parentId\":13583517,\"originalParentId\":13577942,\"likeCount\":0,\"visibility\":\"full\",\"depth\":0,\"attachments\":[\"id\":2024589,\"fileName\":\"junk.jpg\",\"size\":\"82.4 kB\",\"url\":\"/storage/attachments/2024589-junk.jpg\",\"isImage\":true],\"canVoteUpOrCancel\":false,\"relations\":\"canReport\":false,\"visibility\":\"full\",\"canEdit\":false,\"canUseDelete\":false,\"isLiked\":false,\"type\":\"comment\",\"canVoteUpOrCancel\":false,\"canConvertToAnswer\":false,\"canBeModerated\":false,\"canViewRevisions\":false,\"showInReply\":false,\"reported\":false,\"canCancelReport\":false,\"canDelete\":false,\"canVoteDownOrCancel\":false,\"canComment\":false,\"canViewReports\":false,\"isCurrentUserAuthor\":false,\"liked\":false,\"moderatorComment\":false],\"13584998\":\"rootParentId\":13584998,\"commentsCount\":1,\"comments\":[\"body\":\"As you said it was printer driver issue.In WPF VS2017 ,when we are printing what ever driver name is printed on the physical printer .The printer needs to be installed with the exact driver name .If there is even a slight mismatch in the driver name ,it was causing junk values to be printed when printing programmatically through VS2017.Normal printing will work if there is mismatch in drivers.Also this issue is not there in VS2010 with Webforms .I have tested this in 2 printers in different countries and i was able to print successfully. \",\"author\":\"username\":\"vamsikris27\",\"displayName\":\"vamsi krishna\",\"groupIcons\":[],\"suspended\":false,\"isCurrentUser\":false,\"parentAuthor\":\"username\":\"ido.millet\",\"displayName\":\"Ido Millet\",\"groupIcons\":[],\"suspended\":false,\"isCurrentUser\":false,\"id\":13587187,\"creationDate\":1645101412000,\"activeRevisionId\":14073040,\"lastActivity\":1645101412000,\"parentId\":13584998,\"originalParentId\":13577942,\"likeCount\":0,\"visibility\":\"full\",\"depth\":0,\"attachments\":[],\"canVoteUpOrCancel\":false,\"relations\":\"canReport\":false,\"visibility\":\"full\",\"canEdit\":false,\"canUseDelete\":false,\"isLiked\":false,\"type\":\"comment\",\"canVoteUpOrCancel\":false,\"canConvertToAnswer\":false,\"canBeModerated\":false,\"canViewRevisions\":false,\"showInReply\":false,\"reported\":false,\"canCancelReport\":false,\"canDelete\":false,\"canVoteDownOrCancel\":false,\"canComment\":false,\"canViewReports\":false,\"isCurrentUserAuthor\":false,\"liked\":false,\"moderatorComment\":false],\"13585222\":\"rootParentId\":13585222,\"commentsCount\":1,\"comments\":[\"body\":\"I downloaded the report to my desktop ,the document was downloaded with correct content .Then i used PrintDocument to print the document in my desktop ,junk values were printing .I think its some issue with PrinterSettings property.\\nExportFormatType formatType = ExportFormatType.NoFormat; formatType = ExportFormatType.PortableDocFormat; ObjDoc.ExportToDisk(formatType, exportPath + "\\\\\\\\UndertakingDoc.pdf"); ObjDoc.Dispose(); PrintDocument pd = new PrintDocument(); pd.PrinterSettings.PrintFileName= exportPath + "\\\\\\\\UndertakingDoc.pdf"; pd.PrinterSettings.PrinterName = cmbPrinter.SelectedValue.ToString().Trim();\\n\\npd.Print();\",\"author\":\"username\":\"vamsikris27\",\"displayName\":\"vamsi krishna\",\"groupIcons\":[],\"suspended\":false,\"isCurrentUser\":false,\"parentAuthor\":\"username\":\"don.williams\",\"displayName\":\"Don Williams\",\"groupIcons\":[\"name\":\"moderator\",\"title\":\"This user is an SAP Moderator\",\"priority\":20,\"name\":\"employee\",\"title\":\"This user is an SAP Employee\",\"priority\":21],\"suspended\":false,\"isCurrentUser\":false,\"id\":13584392,\"creationDate\":1644741175000,\"activeRevisionId\":14069072,\"lastActivity\":1644741175000,\"parentId\":13585222,\"originalParentId\":13577942,\"likeCount\":0,\"visibility\":\"full\",\"depth\":0,\"attachments\":[],\"canVoteUpOrCancel\":false,\"relations\":\"canReport\":false,\"visibility\":\"full\",\"canEdit\":false,\"canUseDelete\":false,\"isLiked\":false,\"type\":\"comment\",\"canVoteUpOrCancel\":false,\"canConvertToAnswer\":false,\"canBeModerated\":false,\"canViewRevisions\":false,\"showInReply\":false,\"reported\":false,\"canCancelReport\":false,\"canDelete\":false,\"canVoteDownOrCancel\":false,\"canComment\":false,\"canViewReports\":false,\"isCurrentUserAuthor\":false,\"liked\":false,\"moderatorComment\":false],\"13583683\":\"rootParentId\":13583683,\"commentsCount\":1,\"comments\":[\"body\":\"Hi,\\n I am using ReportDocuments PrintToPrinter method . \\nI was using Arial Font in the crystal report .I changed the Font to Consolas and i still get the same issue .\\nI can export to Disk successfully into PDF format ,only when i print a document i face the issue .\\nNo i didnt test using your printer test app because my requirement of project is that user shouldnt get an option where he chooses printer or number of copies ,no print dialog or any interface.\\n In CR Desginer,in the preview tab when i print the report by using print button i get junk value again. \",\"author\":\"username\":\"vamsikris27\",\"displayName\":\"vamsi krishna\",\"groupIcons\":[],\"suspended\":false,\"isCurrentUser\":false,\"parentAuthor\":\"username\":\"don.williams\",\"displayName\":\"Don Williams\",\"groupIcons\":[\"name\":\"moderator\",\"title\":\"This user is an SAP Moderator\",\"priority\":20,\"name\":\"employee\",\"title\":\"This user is an SAP Employee\",\"priority\":21],\"suspended\":false,\"isCurrentUser\":false,\"id\":13584931,\"creationDate\":1645008188000,\"activeRevisionId\":14069729,\"lastActivity\":1645008188000,\"parentId\":13583683,\"originalParentId\":13577942,\"likeCount\":0,\"visibility\":\"full\",\"depth\":0,\"attachments\":[],\"canVoteUpOrCancel\":false,\"relations\":\"canReport\":false,\"visibility\":\"full\",\"canEdit\":false,\"canUseDelete\":false,\"isLiked\":false,\"type\":\"comment\",\"canVoteUpOrCancel\":false,\"canConvertToAnswer\":false,\"canBeModerated\":false,\"canViewRevisions\":false,\"showInReply\":false,\"reported\":false,\"canCancelReport\":false,\"canDelete\":false,\"canVoteDownOrCancel\":false,\"canComment\":false,\"canViewReports\":false,\"isCurrentUserAuthor\":false,\"liked\":false,\"moderatorComment\":false],\"13583859\":\"rootParentId\":13583859,\"commentsCount\":1,\"comments\":[\"body\":\"Yes my default printer is not the same when i designed the report .The project was developed in a different country in VB.NET webforms and was running successfully.I changed to a different country and was converting the project to WPF from web forms and thats when the trouble started .The crystal reports .rpt files used are still from the older source.I thought may be thats the issue and created crystal reports new .rpt files in the WPF project .But still getting junk values. \\nI changed the printer drivers too and put settings similar to a printer from old source where printing was successful ,but still it prints same junk value. \\nI will use your test app and print now and get back to you soon.\",\"author\":\"username\":\"vamsikris27\",\"displayName\":\"vamsi krishna\",\"groupIcons\":[],\"suspended\":false,\"isCurrentUser\":false,\"parentAuthor\":\"username\":\"don.williams\",\"displayName\":\"Don Williams\",\"groupIcons\":[\"name\":\"moderator\",\"title\":\"This user is an SAP Moderator\",\"priority\":20,\"name\":\"employee\",\"title\":\"This user is an SAP Employee\",\"priority\":21],\"suspended\":false,\"isCurrentUser\":false,\"id\":13587096,\"creationDate\":1645075289000,\"activeRevisionId\":14069927,\"lastActivity\":1645075289000,\"parentId\":13583859,\"originalParentId\":13577942,\"likeCount\":0,\"visibility\":\"full\",\"depth\":0,\"attachments\":[],\"canVoteUpOrCancel\":false,\"relations\":\"canReport\":false,\"visibility\":\"full\",\"canEdit\":false,\"canUseDelete\":false,\"isLiked\":false,\"type\":\"comment\",\"canVoteUpOrCancel\":false,\"canConvertToAnswer\":false,\"canBeModerated\":false,\"canViewRevisions\":false,\"showInReply\":false,\"reported\":false,\"canCancelReport\":false,\"canDelete\":false,\"canVoteDownOrCancel\":false,\"canComment\":false,\"canViewReports\":false,\"isCurrentUserAuthor\":false,\"liked\":false,\"moderatorComment\":false]"), answerPager: answersCount: 6, page: 1, pageSize: 10, pageCount: 1, sort: "votes" , answers: JSON.parse("[\"body\":\"Sounds like a bad/incompatible printer driver.\",\"author\":\"username\":\"ido.millet\",\"displayName\":\"Ido Millet\",\"groupIcons\":[],\"suspended\":false,\"isCurrentUser\":false,\"id\":13584998,\"posted\":1645020045000,\"votes\":1,\"isAccepted\":true,\"isLocked\":false,\"userVoted\":\"\",\"relations\":\"score\":1,\"canCancelAccept\":false,\"canUnlock\":false,\"canUseDelete\":false,\"accepted\":true,\"canVoteDownOrCancel\":false,\"canLock\":false,\"canAccept\":false,\"type\":\"answer\",\"canVoteUpOrCancel\":false,\"isCurrentUserAuthor\":false,\"attachments\":[],\"body\":\"I see you are using .NET Framework 4.7.2, but have .NET Framework 2.0 version of Crystal 13.0.2000.0.You should use .NET Framework 4.X version of Crystal 13.0.4000.0. This would be SP 26 or higher.Please Review this Wiki for how to upgrade: +Reports%2C+Developer+for+Visual+Studio+Downloads\",\"author\":\"username\":\"pguss_sri\",\"displayName\":\"Patrick Guss\",\"groupIcons\":[],\"suspended\":false,\"isCurrentUser\":false,\"id\":13576975,\"posted\":1644327422000,\"votes\":0,\"isAccepted\":false,\"isLocked\":false,\"userVoted\":\"\",\"relations\":\"canCancelAccept\":false,\"canUnlock\":false,\"canUseDelete\":false,\"canVoteDownOrCancel\":false,\"canLock\":false,\"canAccept\":false,\"type\":\"answer\",\"canVoteUpOrCancel\":false,\"isCurrentUserAuthor\":false,\"attachments\":[],\"body\":\"On my WIKI page I wrote a simple Printer test app:Printing Crystal Reports in .NETSave the report with data and see if that works using both P2P and POC routines.Don\",\"author\":\"username\":\"don.williams\",\"displayName\":\"Don Williams\",\"groupIcons\":[\"name\":\"moderator\",\"title\":\"This user is an SAP Moderator\",\"priority\":20,\"name\":\"employee\",\"title\":\"This user is an SAP Employee\",\"priority\":21],\"suspended\":false,\"isCurrentUser\":false,\"id\":13585222,\"posted\":1644515442000,\"votes\":0,\"isAccepted\":false,\"isLocked\":false,\"userVoted\":\"\",\"relations\":\"canCancelAccept\":false,\"canUnlock\":false,\"canUseDelete\":false,\"canVoteDownOrCancel\":false,\"canLock\":false,\"canAccept\":false,\"type\":\"answer\",\"canVoteUpOrCancel\":false,\"isCurrentUserAuthor\":false,\"attachments\":[],\"body\":\"What do you mean by junk characters?If it's boxes itt means the font is missing.Take a screen shot of the viewer so we can see what you mean?\",\"author\":\"username\":\"don.williams\",\"displayName\":\"Don Williams\",\"groupIcons\":[\"name\":\"moderator\",\"title\":\"This user is an SAP Moderator\",\"priority\":20,\"name\":\"employee\",\"title\":\"This user is an SAP Employee\",\"priority\":21],\"suspended\":false,\"isCurrentUser\":false,\"id\":13583517,\"posted\":1644872940000,\"votes\":0,\"isAccepted\":false,\"isLocked\":false,\"userVoted\":\"\",\"relations\":\"canCancelAccept\":false,\"canUnlock\":false,\"canUseDelete\":false,\"canVoteDownOrCancel\":false,\"canLock\":false,\"canAccept\":false,\"type\":\"answer\",\"canVoteUpOrCancel\":false,\"isCurrentUserAuthor\":false,\"attachments\":[],\"body\":\"Cool report, not much help but it looks interesting...So are you using PrintToPrinter (P2P) or PrintOutputController (POC) to print?CR will not attach a licensed font when exporting to PDF, not allowed to.What CR or Adobe does is use Font substitutions, it looks like that is what is happening and it's either using some Symbol font or some none unicode font that is being interpreted to single or double byte.So what font are you using?Try a different oneTry exporting to a different format like WordDid you test using my Printer test app?What happens in CR Designer when you export and print?\",\"author\":\"username\":\"don.williams\",\"displayName\":\"Don Williams\",\"groupIcons\":[\"name\":\"moderator\",\"title\":\"This user is an SAP Moderator\",\"priority\":20,\"name\":\"employee\",\"title\":\"This user is an SAP Employee\",\"priority\":21],\"suspended\":false,\"isCurrentUser\":false,\"id\":13583683,\"posted\":1644937888000,\"votes\":0,\"isAccepted\":false,\"isLocked\":false,\"userVoted\":\"\",\"relations\":\"canCancelAccept\":false,\"canUnlock\":false,\"canUseDelete\":false,\"canVoteDownOrCancel\":false,\"canLock\":false,\"canAccept\":false,\"type\":\"answer\",\"canVoteUpOrCancel\":false,\"isCurrentUserAuthor\":false,\"attachments\":[],\"body\":\"The point is using my test app to see if it works, you can use P2P or POC to do the printing. You don't have to preview it first.P2P uses your default printer the report was designed with, it won't change to to your default printer.As Ido suggested it sounds like your default printer is not what was used when you designed the report.\",\"author\":\"username\":\"don.williams\",\"displayName\":\"Don Williams\",\"groupIcons\":[\"name\":\"moderator\",\"title\":\"This user is an SAP Moderator\",\"priority\":20,\"name\":\"employee\",\"title\":\"This user is an SAP Employee\",\"priority\":21],\"suspended\":false,\"isCurrentUser\":false,\"id\":13583859,\"posted\":1645020671000,\"votes\":0,\"isAccepted\":false,\"isLocked\":false,\"userVoted\":\"\",\"relations\":\"canCancelAccept\":false,\"canUnlock\":false,\"canUseDelete\":false,\"canVoteDownOrCancel\":false,\"canLock\":false,\"canAccept\":false,\"type\":\"answer\",\"canVoteUpOrCancel\":false,\"isCurrentUserAuthor\":false,\"attachments\":[]]"), answerForm: formAction: "/answers/13577942/post.json", textareaName: "body", textareaErrors: "", isAttachmentsEnabled: true, answerEditorialGuideline: title: "Before answering", content: "You should only submit an answer when you are proposing a solution to the poster\'s problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that your answer complies with our Rules of Engagement.", links: [ title: "Rules of Engagement", href: " -of-engagement.html", ] , answerMinBodyLength: '10', answerMaxBodyLength: '20000' , currentUser: sapInternalId: '', permissions: canVoteUpOrCancel: false, canVoteDownOrCancel: false, canModerate: false, , isVotedUp: false, isVotedDown: false , alerts: alertModeratorMinLength : "It should be given a proper explanation about why the content is inappropriate.", alertModeratorMinLengthValue : "10", alreadyReportedMessage : "You already have an active moderator alert for this content." , url: profileApiBaseUrl: ' -api.services.sap.com', followUnfollowQuestion: '/sap/nodeSubscription.json', isFollowingQuestion: '/sap/isFollowingNode.json', vote: voteUp: '/commands/0/voteup.json', voteDown: '/commands/0/votedown.json', cancelVote: '/commands/0/cancelvote.json' , rss: answers: '/feed/13577942/answers.rss', answersAndComments: '/feed/13577942/comments-and-answers.rss' , authorizeUploadContext: type: 'answer' , atMention: userSearchServiceUrl: ' ', currentUserName: '', useNewUSSCORS: true, atMentionDelayMs: 100, showMentionInRedactor: true , attachmentSettings: commentMaxAttachments: '2', answerMaxAttachments: '10', commentMaxAttachmentSizeBytes: '1048576', answerMaxAttachmentSizeBytes: '1048576', commentAttachmentsSizeBytesTotal: '2097152', answerAttachmentsSizeBytesTotal: '10485760' , editor: editorClipboardUploadEnabled: true ) )(); Home

  • Community

  • Ask a Question

  • Write a Blog Post

Login / Sign-up Search Questions and Answers 0 vamsi krishna Feb 08, 2022 at 06:00 AM Setting PrinterSettings.PrinterName leads to printing of junk value on print of crystal report 472 Views Follow RSS Feed Hi, I am trying to print a crystal report in WPF C# by sending it directly to printer without a viewer .The user can select different printers based on a drop down .However when i try to set PrinterSettings.PrinterName="PrinterName" ,the printer is printing junk values.I am using VS2017,WPF ,OS-Windows 10,.NET Framework-4.7.2, 2ff7e9595c


0 views0 comments

Recent Posts

See All

Comentários


bottom of page