function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
sp08830sp08830 

Need urgent help converting text to PD

Need some urgent help with converting text to PDF. Here is a snippet of my code. 

 

UserDoc__c is a long text field. It was works fine when it was a rich text field. 

 

Not the problem is, all spaces are removed and entire document appears as a single paragraph on PDF.  Appreciate any inputs. 

 

Blob b;
String attid;
b = blob.toPdf(candidate.UserDoc__c);
if (b != null) {
    attachment = new Attachment(Name = 'Profile.pdf', Body = b);
    attachment.OwnerId = UserInfo.getUserId();
    attachment.ParentId = Step2.id;
    attachment.IsPrivate = false;
    insert attachment;