Created
November 18, 2020 20:54
-
-
Save BrianMRO/e4b9bbc91f758d9adf9a5f871e74d34e to your computer and use it in GitHub Desktop.
UploadLabelControlFile
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
protected virtual bool UploadLabelControlFile(StringBuilder labelSB, string language) | |
{ | |
byte[] labelBytes = Encoding.ASCII.GetBytes(labelSB.ToString()); | |
// Define a unique filename for the label control file | |
string filename = "label-" + | |
Guid.NewGuid().ToString() + | |
"." + | |
language.ToLower(); | |
// Create a FileInfo for the file byte array using the filename above | |
PX.SM.FileInfo labelFileInfo = new FileInfo(filename, null, labelBytes); | |
// Upload into Acumatica | |
UploadFileMaintenance upload = PXGraph.CreateInstance<UploadFileMaintenance>(); | |
// If the upload was successful, print the file | |
if (upload.SaveFile(labelFileInfo)) | |
{ | |
DHPrint(labelFileInfo, printer); | |
return true; | |
} | |
return false; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment