Dear all.

What I am about to describe, happens happens in both Stata 15 and Stata 16, running on Windows 7 Professional.

I have a quarterly database with three variables (VoHHIRev, VoHHITraf, and VoHHIUsers) I want to plot and export into a PDF file. These variables refer to HHI indicators for a couple of different markets identified with variable MarketType.

In the plot, I use a text box to specify which plotted line refers to which market (mobile or fixed):
Array



The command I use to get this plot is as follows:

local a = yq(2014,1) // Obtain value for 2014q1 to use it in the graph command below
graph twoway (line VoHHIUsers Quarter if(MarketType == 1), lcolor(navy)) || ///
(line VoHHIRev Quarter if(MarketType == 1), lcolor(maroon) ) || ///
(line VoHHITraf Quarter if(MarketType == 1), lcolor("85 117 47")) || ///
(line VoHHIUsers Quarter if(MarketType == 2), lcolor(navy) lpattern(shortdash_dot)) || ///
(line VoHHIRev Quarter if(MarketType == 2), lcolor(maroon) lpattern(shortdash_dot)) || ///
(line VoHHITraf Quarter if(MarketType == 2), lcolor("85 117 47") lpattern(shortdash_dot)), ///
xline(`a', lpattern("-") lcolor(green)) legend(order(1 "Users" 2 "Revenue" 3 "Traffic")) ///
ttext(0.6 2017q2 "Mobile", placement(se) box just(left) margin(l+2 t+1 b+1) fcolor(white) width(12)) ttext(0.55 2017q2 "Fixed", placement(se) box just(left) margin(l+2 t+1 b+1) fcolor(white) width(12) lpattern(shortdash_dot))

However, when I try to export this graph to PDF -graph export "$OutPath/HHIVoice.pdf", as(pdf) replace-, I get the next error message:

unable to save PDF file
r(691);

It is worth noting that I have already checked path length and other recommendations given formerly in this same forum and other Internet resources. Even, I tried to export (unsuccessfuly) directly from the plot window File -> Save as ...

After going back and forth with different command specifications to get the PDF exported successfuly, I realized that I can only export the plot if I remove the text boxes. I mean, the next plot command allows me to export to PDF (note there is no "ttext()" option written):

graph twoway (line VoHHIUsers Quarter if(MarketType == 1), lcolor(navy)) || ///
(line VoHHIRev Quarter if(MarketType == 1), lcolor(maroon) ) || ///
(line VoHHITraf Quarter if(MarketType == 1), lcolor("85 117 47")) || ///
(line VoHHIUsers Quarter if(MarketType == 2), lcolor(navy) lpattern(shortdash_dot)) || ///
(line VoHHIRev Quarter if(MarketType == 2), lcolor(maroon) lpattern(shortdash_dot)) || ///
(line VoHHITraf Quarter if(MarketType == 2), lcolor("85 117 47") lpattern(shortdash_dot)), ///
xline(`a', lpattern("-") lcolor(green)) legend(order(1 "Users" 2 "Revenue" 3 "Traffic"))

I still need the text box ("Mobile" and "Fixed" in the previous picture) in the PDF. Could you please let me know what to do (or what am I doing wrong) to get the plot I need in PDF format?.

Renzo.